The mapping file I used:
<hibernate-mapping package="com.novell.uddi3.hibernate.entities">
<class name="BusinessVO" table="businessvo">
<id name="id" type="string">
<generator class="assigned" />
</id>
<list name="Contacts" cascade="delete" lazy="true">
<key column="bid" />
<list-index column="sortorder"/>
<one-to-many class="ContactVO" />
</list>
</class>
<class name="ContactVO" table="contacts">
<id name="id">
<generator class="native"/>
</id>
<array name="PersonName" cascade="all" table="personnames" fetch="join">
<key column="cid" />
<list-index column="sortorder"/>
<composite-element class="org.uddi.v3.core.PersonName">
<property name="_value" type="string" column="personname" length="4000"/>
</composite-element>
</array>
</class>
</hibernate-mapping>
When I execute a hsql like following:
Query q = session.createQuery("from BusinessVO b" +
" left join fetch b.Contacts c" +
" left join fetch c.PersonName");
BusinessVO vo = (BusinessVO)q.uniqueResult();
From the console, the following sql was created:
select
businessvo0_.id as id0_0_,
contacts1_.id as id1_1_,
personname2_.cid as cid1__,
personname2_.personname as personname1__,
personname2_.sortorder as sortorder1__,
contacts1_.bid as bid0__,
contacts1_.id as id0__,
contacts1_.sortorder as sortorder0__,
personname2_.cid as cid1__,
personname2_.personname as personname1__,
personname2_.sortorder as sortorder1__
from
businessvo businessvo0_
left outer join
contacts contacts1_
on businessvo0_.id=contacts1_.bid
left outer join
personnames personname2_
on contacts1_.id=personname2_.cid
The alias 'cid1_, personename1, sortorder1_' are duplicate, is this a bug of hibernate?
Hibernate 3.2.5, database sybase 12.52
I just saw a comment in 'processQuery(AST select, AST query)' of class org.hibernate.hql.ast.HqlSqlWalker:
//TODO: the only reason we need this stuff now is collection filters,
// we should get rid of derived select clause completely!
If the derived select clause can be got rid of, the duplicate alias is not problem, and can you give some temporary proposal to resolve this issue,
thank you very much.
In an effort to clean up, in bulk, tickets that are most likely out of date, we're transitioning all ORM 3 tickets to an "Awaiting Test Case" state. Please see http://in.relation.to/Bloggers/HibernateORMJIRAPoliciesAndCleanUpTactics for more information.
If this is still a legitimate bug in ORM 4, please provide either a test case that reproduces it or enough detail (entities, mappings, snippets, etc.) to show that it still fails on 4. If nothing is received within 3 months or so, we'll be automatically closing them.
Thank you!
Bulk rejecting stale issues. If this is still a legitimate issue on ORM 4, feel free to comment and attach a test case. I'll address responses case-by-case. Thanks!