Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate : partial update of row using Primary key

 
Mohit Sinha
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic