Reputation: 838
I am using kundera-cassandra V3.2 and want to update an entity with the method merge.
this.getManager().merge(entity); // this.getManager is a javax.persistence.EntityManager
Is there a possibility to use a lightweight transaction (IF clause) when calling this method or do I have to create a update query manually?
Upvotes: 0
Views: 114
Reputation: 13640
In Kundera, lightweight transactions are supported through createNativeQuery
method. There is no direct method for merging with lightweight transactions.
Sample code:
String query = "UPDATE \"PERSONCASSANDRA\" SET \"PERSON_NAME\" = 'Pragalbh' WHERE \"PERSON_ID\" = '4' IF \"PERSON_NAME\" = 'Karthik'";
Query q = entityManager.createNativeQuery(query, PersonCassandra.class);
q.executeUpdate();
Please check this test-case for more information.
Upvotes: 2