-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Effective Entity Update In Hibernate ?
PostPosted: Sun Mar 07, 2010 10:37 pm 
Newbie

Joined: Tue Mar 02, 2010 9:25 am
Posts: 7
I've always wanted to know How can I update an entity effectively in hibernate just as by using SQL.

For example : I have a product entity , has a field name createTime , when I use session.saveOrUpdate(product) ; I have to get this field from database and then set to product then update , actually whenever I use session.saveOrUpdate() , I updated ALL fileds , even if I just need update only one field. but most time the value object we passed to DAO layer can't contain all fileds information , like the createDate in Product , we seldom need to update this field. How to just update selected fields ? Of course I can use HQL , but that will separate save and update logic .

It would be better If Hibernate has a method like this :

session.updateOnlyNotNullFields(product);

How can I do this in Hibernate ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.