-->
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: Removing alias
PostPosted: Thu Jan 29, 2004 10:27 am 
Newbie

Joined: Tue Sep 02, 2003 1:12 pm
Posts: 10
Hello,

is there a way to remove the using of aliases in SQL Selects? I want it because its is causing some conflicts in two many-to-one mappings in the same hbm that uses the same column names.

Example:
Code:

<class name="X" table="X">
<composite-id name="id" class="XID">
  <key-many-to-one name="foo" class="Foo">
      <column name="A"/>
      <column name="B"/>
      <column name="C"/>
      <column name="D"/>
  </key-many-to-one>
  <key-property name="num" type="short"/>
</composite-id>

<many-to-one name="bar" class="Bar" update="false" insert="false">
      <column name="A"/>
      <column name="B"/>
      <column name="C"/>
      <column name="E"/>
</many-to-one>
.....
</class>



Columns A, B and C are shared by the two associations, so when I retrieve objects from this class x I get duplicated aliases and my sql dont work.


One solution is eliminate aliases in select because in this case it is not used in the where clause.

Anyone knows how to do that? Or there is other way to solve it?

Thank you

_________________
Henrique Velloso
--------------------
System Architect
FUNDEP - UFMG - BRAZIL


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 29, 2004 7:34 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Alias are very needed by Hibernate. You can't remove them.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 29, 2004 7:36 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
The second many-to-one cannot work, the E column can never be updated or inserted. You'll have to redesign your object model or relational model. I've never seen such a use case before.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 30, 2004 8:44 am 
Newbie

Joined: Tue Sep 02, 2003 1:12 pm
Posts: 10
Hi Emmanuel, thank you for your answer.

Actually, I can

_________________
Henrique Velloso
--------------------
System Architect
FUNDEP - UFMG - BRAZIL


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.