-->
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: Expression's question
PostPosted: Tue Aug 09, 2005 11:46 pm 
Newbie

Joined: Tue Aug 09, 2005 11:35 pm
Posts: 2
three class: Area, Enterprise, Information
Class Area{
}
Class Enterprise{
private Area area
......
......
}
Class Information{
private Enterprise enterprise
......
......
}

while query...
createCriteria(Enterprise.class).add(Expression.eq("area", area)); the result is right....

while query...
createCriteria(Information.class).add(Expression.eq("enterprise", enterprise)); the result is right....

whiel query...
createCriteria(Information.class).add(Expression.eq("enterprise.area", area));
could not resolve property: enterprise.area of: Information

can anyone help me.....
pls....


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 10, 2005 2:25 am 
Expert
Expert

Joined: Thu Sep 04, 2003 8:23 am
Posts: 368
See chapter 16.4 of the doc of hibernate3 (or 12.4 for hibernate2), you have to create an alias or a new criteria to navigate throught associations

Code:
createCriteria(Information.class).createAlias("entreprise", "ent").add(Expression.eq("ent.area", area)

_________________
Seb
(Please don't forget to give credits if you found this answer useful :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 10, 2005 3:17 am 
Newbie

Joined: Tue Aug 09, 2005 11:35 pm
Posts: 2
thank you.....problem is ok now~~~~~~~~^_^


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.