-->
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.  [ 2 posts ] 
Author Message
 Post subject: Null component - where to create
PostPosted: Sat Jun 09, 2007 1:04 pm 
Newbie

Joined: Sat Jun 09, 2007 10:54 am
Posts: 8
Hello,

I have an Advert object that contains an embedded component, Location, which contains details of the Location of the Advert if it can be collected.

I want to create a Location object when an Advert is first created, defaulting to the owner of the adverts postcode, but they can remove the postcode if they want to later.

Now if I create a Location object in the default no args constructor of Advert, when retrieving Adverts from the database, will Hibernate correctly nullify these if the values of the component fields in the database are null ?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 10, 2007 12:09 pm 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
Did you read the reference documentation about components : http://www.hibernate.org/hib_docs/v3/re ... components ?

I think that's what you're asking :
Quote:
The null value semantics of a component are ad hoc. When reloading the containing object, Hibernate will assume that if all component columns are null, then the entire component is null.

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.