Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

New to hibernate: Merge() is not updating

 
laura mccord
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

I'm stumped right now as to why my database table isn't being updated after I set one of the properties and then do a merge().

Here is what I have:



this is my hibernate file:


So before I do the merge() I verified that profile.getImage() had been set. But the update does not occur. Here is what's in my log file.

"My value was passed!!! : : myprofile.jpg
Hibernate: update profile set username=?, image=?, department=?, classification=? where id=?


Any suggestions?

Thanks,
Laura
 
Anantha Sharma
Ranch Hand
Posts: 43
Android Hibernate jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Laura,

try this



the merge method returns an instance of the merged object, the original object passed is not altered at all, which is why you weren't able to see an update..

Regards,
Anantha Sharma
 
Jesus Angeles
Ranch Hand
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any error, or log dumps that will help you debug it? Any unintended new rows inserted on the database instead of the one you intended?
 
Hauke Ingmar Schmidt
Rancher
Posts: 436
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When working with Hibernate it is extremely important to understand the objects life cycle, the persistence context and what the different methods do that work with those.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic