-
Notifications
You must be signed in to change notification settings - Fork 94
Closed
Labels
@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?