-->
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: Possible to return a partial related set?
PostPosted: Thu May 12, 2005 1:04 pm 
Newbie

Joined: Tue Apr 06, 2004 11:54 am
Posts: 2
Hibernate version: 2.1

Name and version of the database you are using: MySQL 4.1


I have a one to many relationship between Asset and AssetState. The purpose of the one to many relationship is to keep a history of the Asset's state.

When I do:
from asset as a
where a.assetId = ?

I get:
The particular asset with a set of all related AssetStates.

When we want to view only the current state I would like to run a query that will only contain a subset of the related AssetState objects - namely the most current AssetState object.

pseudo-query:
find asset
where the assetID = aid0001

setAssetStates
where assetState.stateDate = max(stateDate for this asset's states)

Is this query possible and if so how?

Thank you
Bryon


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.