-->
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: @OneToMany + @OrderBy + limit
PostPosted: Wed May 21, 2008 4:52 am 
Newbie

Joined: Wed May 21, 2008 4:24 am
Posts: 1
Hi guys, I'm quite new with Hibernate. I could really use your help. Basically, I have two entities: let's call it Item and ItemRevision.

The Item, for simplicity, only holds an ID property. All information regarding it is stored in an ItemRevision (such as name). The ItemRevision references some Item it describes and has dateValid property. Basically, a revision is valid from its dateValid up to another entry's dateValid. Assuming all entries have dateValid values in the past, the current revision is that which has the latest dateValid.

Now, I wanted to map the current revision to some property in Item. Problem is that I don't have a limit annotation, any hints?

Code:
@Entity
public class Item {
  @OneToOne //Currently doesn't work without the limit
  @Where("date_valid<=NOW()")
  @OrderBy("dateValid desc")
  //then some other annotation for the limit?
  private ItemLineRevision currentRevision
}


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.