Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Object with _id and _key fields #11

Closed
@mrbatista

Description

I have this situation:

public class User {
 private String email;
 private String name;
 private String surname;
 private String username;
 private String password;
 /* getter and setter*/
}
/* ------- */
public T getByUniqueKey(String key, Object value) throws ArangoException {
String query = "FOR t IN " + getCollectionName() + " FILTER t." + key + " == @" + key + " RETURN t";
Map<String, Object> bindVars = new MapBuilder().put(key, value).get();
 return getConnection().executeQuery(query,
 bindVars, clazz, false, 0).getUniqueResult();
 }
/* ------ */

After calling the getByUniqueKey method, I would do like update the User object.
I cannot use the updateDocument method because I do not have the _id field. In fact,
_id and _key fields are available only when call method that returns DocumentEntity<T> or extends BaseDocument class.
If extends BaseDocument other fields like properties are serialized and saved to DB.
I've used recently this object mapper where each class extends ArangoDbDocument.
I could use this approach, however, would be redundant if the same class is used in a method that returns a DocumentEntity<T>

Any suggestions?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /