Upsert Vertex with Unique Index

Hi,

I am trying to do a Batch operation using OrientDB 3.0 and have Index(unique) on one of the field. Want to know if there is upsert functionality in OrientDB as I dont want ORecordDuplicatedException rather I want to update the record already present with the new values.

Hi,

according to the documentation: http://orientdb.com/docs/3.0.x/sql/SQL-Update.html
the upsert functionality is available for version 3.0.x of OrientDB.

Hope it helps.

Regards,
Michela

Thanks Michela! I did look at this. Actually, I am using JAVA Graph API to create the Vertex. I have a map of values which is dynamic and I am able to just add parse and add the properties whereas in the query mode as its mentioned in the link, and didnt find a way to add the whole map in the query and dont want to do string concatenate operation(would be my last resort). Do you know of any way I could achieve this?

Thanks!

Convert the Map into JSON and then just use CONTENT. You can pass the json in parameterised query.
eg. INSERT INTO Profile CONTENT {"name": "Jay", "surname": "Miner"}

And NEVER use string concatenate, you will open yourself to SQL injections and of course readability mess.