-->
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.  [ 4 posts ] 
Author Message
 Post subject: how to query on a component property
PostPosted: Sat Nov 19, 2005 10:12 am 
Newbie

Joined: Fri Sep 02, 2005 10:25 am
Posts: 5
Hi,

Using the Criteria API, I'd like to know how to query on a component property.

public AuditSegment {

private Date creationDate;
...

}

public APersistentObject {

private AuditSegment auditSegment;
}

I'd like to retrieve all APersistentObject instances that are created since 18/11/2005.

Can somebody help me ? I found no doc on that.

Thanks
Christophe


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 19, 2005 8:31 pm 
Regular
Regular

Joined: Wed Aug 25, 2004 7:40 pm
Posts: 65
How about

"form APersistentObject po where po.auditSegment.creationDate =: theDate"

and plug in the date here.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 20, 2005 5:07 am 
Newbie

Joined: Fri Sep 02, 2005 10:25 am
Posts: 5
I already saw an example like that one. But I want to use the Criteria API... is it possible ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 10:02 am 
Regular
Regular

Joined: Sat Nov 05, 2005 5:33 am
Posts: 70
Location: Linz, Austria
Code:
Criteria crit = session.createCriteria( APersistentObject.class );
crit.createCriteria( "auditSegment" ).add( Restrictions.eq( "creationDate", theDate ) );
crit.list();

_________________
hth,
Heinz
Don't forget to rate if this helped


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.