I have an OrientDB database with a class with the EMBEDDEDSET / EMBEDDEDLIST , and I need to update this field every time I change something, for example, the logbook.
I use regular insert :
insert into order set ..., logLikeField = "A new value"
At the same time, the new value replaces the old ones, and I need to add it to the list, but I canβt find out how to do this in the documents.
Now I take the list and add a new value and replace the old list (first a select , then update ), but I do not like it, and I need to do this with the smallest possible queries.
By the way, I use Java (without JDBC).
[EDIT]
As suggested in the answer below, I used:
insert into order add logLikeField = "A new value"
It worked great in Studio OrientDB, but does nothing when I call it from my program.
This is the code (Spanish):
db.command(command("update ordenes set fecha = ?, numero = ?, producto = ? where @rid = " + orden.id)).execute(orden.fecha, orden.numero, orden.producto); db.command(command("update ordenes add registro = ? where @rid = " + orden.id)).execute(registro);
I need a one line solution, but so far it is not a good choice.
This is the command method:
public OCommandSQL command(sql){ return new OCommandSQL(sql); }
the first command does the job correctly, but with the other I get nothing, not even an exception.
What is wrong with my approach? could it be a mistake?
OrientDB 1.3.0 - Java 1.7.0 - Windows 7 64