Updating an entity object without loading the same
Keerthi Kumar Narayan
Joined: Feb 01, 2013
Im quite new to JPA. I have a requirement where i need to create a plan and update whenever required. In the current implementation, to update a plan, that plan will be reloaded first and then set or update to the required values and persist it. So, is there any way in JPA to update the plan directly without loading it from the database?
Thanks in advance.
Keerthi Kumar N
Joined: Oct 01, 2007
Reading the object, then updating it is normally the best way to update an object, and ensure correct versioning/locking, caching and consistency.
You can also issue a direct update in JPQL using an UPDATE query,