-->
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: Linking to latest entry only in a parent-child assocation?
PostPosted: Wed Apr 03, 2013 2:50 am 
Regular
Regular

Joined: Tue Apr 10, 2007 10:02 am
Posts: 56
I have a project design for 'Project' and 'Project status' as follows:

Code:
public class Project {
    long ID;
    String Title
    ...
    ...
}

public class ProjectStatus {
   long ProjectID;
   String StatusDescription;
   Date ChangeDate;
   ...
}


There are two tables: one for 'Project', a second for 'ProjectStatus'. A project's status can change over time, so for each record in the 'Project' table there might be multiple related entries in the 'ProjectStatus' table.

My question is from a Hibernate perspective how can I include the 'latest' status as part of the 'Project' class definition?

In other words I don't want...

Code:
public class Project {
    long ID;
    String Title
    ...
    ...
   ArrayList<ProjectStatus> StatusList;

}


Instead I'm looking for....

Code:
public class Project {
    long ID;
    String Title
    ...
    ...
   ProjectStatus LatestStatus;

}


The 'LatestStatus' is the project related entry in the 'ProjectStatus' table with the most recent date.

Any suggestions?


Top
 Profile  
 
 Post subject: Re: Linking to latest entry only in a parent-child assocation?
PostPosted: Thu Apr 04, 2013 4:03 am 
Newbie

Joined: Wed Mar 13, 2013 11:32 am
Posts: 16
Try having a look at hibernate specifications for @Where and @JoinFormula


Top
 Profile  
 
 Post subject: Re: Linking to latest entry only in a parent-child assocation?
PostPosted: Fri Apr 12, 2013 5:04 pm 
Regular
Regular

Joined: Tue Apr 10, 2007 10:02 am
Posts: 56
I'm using XML configuration not annotations


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.