Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Hibernate : partial update of row using Primary key

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

author and cow tipper
Posts: 5000
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
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic