Hi,
I'm trying to map a schema with the latest Hibernate EJB3 release + JBoss 4.0.3RC1 on Oracle 9.2.
In my model, a SESSION represents a snapshot of saved data. For each EXPERIMENT there are multiple past SESSIONs representing all past snapshot s. An EXPERIMENT needs a link to its latest SESSION only.
So I want to be able to call getSession() on my Experiment object to retrieve the latest Session - the highest numbered session for that Experiment. Is there any way to map this with Hibernate (with or without annotations) - i.e. selecting the max() session number for that experiment from the SESSION table and using this to populate the Session object? Or do I need to separately query for the Session for that Experiment and forget about direct mapping?
Many thanks,
Tom.
|