-->
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: Joining on the Same Table - How to Do ?
PostPosted: Fri Oct 27, 2006 10:48 am 
Beginner
Beginner

Joined: Wed Sep 13, 2006 7:24 am
Posts: 26
Hibernate version: 3.1



In Code we are trying to join on the same table twice, but with different alias. The criteria query is not happy about it

see error:

Code:
org.hibernate.QueryException: duplicate alias: multiStatic
        at org.hibernate.loader.criteria.CriteriaQueryTranslator.createAliasCriteriaMap(CriteriaQueryTranslator.java:128)
        at org.hibernate.loader.criteria.CriteriaQueryTranslator.<init>(CriteriaQueryTranslator.java:79)
        at org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:58)
        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1514)
        at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)


In SQL i can do Select * from TableA a, TableA, b where a.id=b.=id, so why can i not do a join on the same table twice.

you can not do
Code:
myCriteria.createCriteria("feed.multiStatic", "static1", Criteria.LEFT_JOIN)
myCriteria.createCriteria("feed.multiStatic", "static2", Criteria.LEFT_JOIN)


Any suggestions on how this can be overcome welcome ...

Thanks

_________________
Ben


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.