-->
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.  [ 3 posts ] 
Author Message
 Post subject: Completion of pojo from db
PostPosted: Fri Feb 03, 2006 7:06 am 
Newbie

Joined: Fri Oct 28, 2005 11:33 am
Posts: 13
I have an instance of a pojo object with some properties set (lets say a customer with its name and id set). I know the object exists in the db.

Is there a way to complete the pojo with data from the db, i.e. load all other properties from the db into the pojo, but keep the ones that are already set -- they are assumed to be more up to date.

(I know, the alternative would be to load the object first and then set the values, but this is not an option here. I also know, I could write a query to retrieve all properies for that object individually and then copy them into the pojo, but I am looking for something more generic that would work for all my classes).


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 9:44 am 
Newbie

Joined: Fri Oct 28, 2005 11:33 am
Posts: 13
Is this either so trivial or so uncommon that no-one feels like answering?

Or is my description not understandable. Please, where are the Hibernate experts?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 08, 2006 8:47 pm 
Newbie

Joined: Fri Dec 17, 2004 8:37 pm
Posts: 2
Location: Oakland, Ca, USA
There isn't any function in hibernate for doing what you describe. There is QueryByExample which would allow you to query the database with the partially completed object you describe, but updateing the fields with the more current values is up to you.

_________________
remick


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

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.