-->
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: Mapping to one instance in a set of other entries?
PostPosted: Thu Aug 20, 2009 8:06 am 
Regular
Regular

Joined: Tue Apr 10, 2007 10:02 am
Posts: 56
When mapping set associations to an entity, is it possible to map just entry from that set using selection criteria?

Take the following example: a 'Project' entity has a set of 'ProjectStatus' entries. Typically the Project class would include a set of all 'ProjectStatus' entries, as shown in class 'Project1 below...

Code:

    public class ProjectStatus {
        private Date Changed;
        private Status Status;
        ....
    }

    public class Project1 {
        private String ID;
        private String Title;
        private Set<ProjectStatus> StatusEntries;
        ...
    }

    public class Project2 {
        private String ID;
        private String Title;
        private ProjectStatus CurrentStatus; // the Project Status entry with the most recent 'changed' date
        ...
    }


However, I'm really only interested in the latest 'ProjectStatus' drawn from the set with the most recent 'changed' date. Is it possible to map 'currentStatus' within the Project entity, as shown in 'Project2' above?


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.