I have found few work around of my query in internet but still posting here for different solution.
While updating an row through JPA (I'm using toplink), I need to pass a subset of column values and update only those columns. Other column values should not be forced set to null. In different scenarios I will provide values for different columns. Is there any was to do it (PS: without making any query to database to get the object and then updating it)?
Thanks for the response. Please let me elaborate my problem and what I'm trying to achieve.
I'm taking a generic approach in insert and update operations. The data that i'm saving in db is coming from some JSON and I can retrieve the Entity class name from URL. I'm creating an object from JSON. In different scenarios object will be of different entity classes and I'm also able to cast them to the respective entity using reflection.
I could have used update query but the incoming data might contain some OneToMany relationships, so I've stick with merge() so that in single call the whole data can be saved. Due to generic approach my update logic cannot contain any code that sets the fields of a particular class. Is there any way to achieve this staying with my current approach.
permaculture is giving a gift to your future self. After reading this tiny ad: