-->
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: Problems with implici joins
PostPosted: Mon Jun 13, 2005 12:28 pm 
Regular
Regular

Joined: Mon Jun 13, 2005 12:21 pm
Posts: 61
Location: Hannover
Hi,

I got a question on using implicit joins with Hibernate 3. I've tried to make an implicit join using Criteria API with the following query.
Code:
       session.createCriteria(Key.class)
          .add(Restrictions.eq("customer.name","abc"))
          .uniqueResult();


This doesn't work and results in an error ("Cannot find property cusomter.name"). When I'm trying to make the same query with a (more or less silly) alias the whole things works fine:

Code:
session.createCriteria(Key.class)
          .createAlias("customer","alias1")
          .add(Restrictions.eq("alias1.name","abc"))
          .uniqueResult();
Can somebody explain this behavoir?

Greetings
Joerg

Hibernate version: 3.0.5


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 13, 2005 2:12 pm 
Expert
Expert

Joined: Sat Jan 17, 2004 2:57 pm
Posts: 329
Location: In the basement in my underwear
Yes, there are no implicit joins using the criteria api.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 13, 2005 2:16 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Of course there are. Just not for value types.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 13, 2005 2:36 pm 
Regular
Regular

Joined: Mon Jun 13, 2005 12:21 pm
Posts: 61
Location: Hannover
Guess this doesn't explain the behavoir. Customer is not a value type.


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.