-->
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: Mapping with constraint advice ?
PostPosted: Wed Apr 23, 2008 12:09 pm 
Regular
Regular

Joined: Thu Aug 28, 2003 2:42 pm
Posts: 77
Location: The Netherlands
Hellu,

I have a User class that has collection of addresses that are contained in another table (as Valuetype objects).

I always need the latest address, that he is currently living. The address has a startDate and endDate property. The latter one is null for the current address he is living.

I would like to add a property in the User object called currentAddress, that always contains the latest address object and is managed by Hibernate, and is able to cascade.

Please some advice on how to do this ?

I tried several options,,.. but can't figger it out :(...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 24, 2008 2:41 am 
Regular
Regular

Joined: Mon Aug 06, 2007 10:49 am
Posts: 67
Location: Banska Bystrica, Slovakia
yes it is possible using formula.

here is example described:

http://www.onjava.com/pub/a/onjava/2005 ... tml?page=3

but dont forget that this will always cause one extra select for loading User


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 24, 2008 3:50 am 
Regular
Regular

Joined: Thu Aug 28, 2003 2:42 pm
Posts: 77
Location: The Netherlands
Thanks Ferozz, I will have a look at it


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.