-->
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: adding restrictions to a criteria
PostPosted: Sun Jan 01, 2006 1:17 pm 
Beginner
Beginner

Joined: Thu Sep 22, 2005 7:22 am
Posts: 21
Hibernate version: 3.1
I try to add this restriction to a criteria;
Code:
session.createCriteria(Entry.class)
.add(Restrictions.eq("owner.collective", collective))
.list();


but I get
Code:
org.hibernate.QueryException: could not resolve property: owner.collective of: net.keso.ted.peng.Entry


the Entry contains a owner and the owner contains a collective...
as I read the manual I get the impression that this is how it should be done..

_________________
/ted


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 01, 2006 1:45 pm 
Regular
Regular

Joined: Wed May 05, 2004 8:01 am
Posts: 53
maybe you should try:
Code:
session.createCriteria(Entry.class).createCriteria( "owner" )
.add(Restrictions.eq("collective", collective))
.list();


did that help?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 01, 2006 4:58 pm 
Beginner
Beginner

Joined: Thu Sep 22, 2005 7:22 am
Posts: 21
ouzo wrote:
maybe you should try:
Code:
session.createCriteria(Entry.class).createCriteria( "owner" )
.add(Restrictions.eq("collective", collective))
.list();


did that help?


yes it did, thank you!

_________________
/ted


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.