wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Hibernate : partial update of row using Primary key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate : partial update of row using Primary key" Watch "Hibernate : partial update of row using Primary key" New topic
Author

Hibernate : partial update of row using Primary key

Mohit Sinha
Ranch Hand

Joined: Nov 29, 2004
Posts: 125
Hi All,

I have a scenario in Hibernate where in I have the Primary key information of a table and I want to update a specific column value.
I don't want to load all the column data for each row as the number of columns is pretty large. When I try to do something like this Hibernate updates the specific column in the database but nullifies all the existing column data.

I tried searching on this topic and could not get a worthwhile solution. Is there a way where I can carry out a update to a table row purely based on the Primary Key. I don't want to pre-load all the column data attributes as for this scenario as i don't want the extra column data but at the same time I don't even want to loose it when Hibernate fires the update.
Is there a way to achieve this is Hibernate

Mohit
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

You know, this sound like it might be a job for just some simple SQL. I mean, you're sort of saying that you want to do a quick update, but not take advantage of all of the benefits of Hibernate. So, the solution would be just a quick and simple update without using Hibernate. There's no shame in issuing an SQL statement when it's an appropriate solution.

-Cameron McKenzie
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate : partial update of row using Primary key
 
Similar Threads
Help me to Update only selected Fields and not all the columns in database through hibernate ??
problem with sql statement in my setValueAt method
OJB and Unique Keys
Hibernate / Composite primary key / Annotations issue
updating primary key