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.  [ 2 posts ] 
Author Message
 Post subject: bidrectional relationship problem
PostPosted: Wed Jul 27, 2005 8:29 am 
Newbie

Joined: Wed Jul 27, 2005 6:00 am
Posts: 1
Hi,

I am having a problem getting clollection which have a bidirectional
one-to-many / many-to-one mapping.

first mapping
Code:
<class name="Products" table="Products">
<id name="productID" type="int" unsaved-value="null">
     <column name="ProductID"/>
</id>
<set name="orderDetails" inverse="true">
    <key>
      <column name="productID"/>
     </key>
   <one-to-many class="OrderDetails"/>
  </set>
</class>


and second
Code:
<class name="OrderDetails" table="[Order Details]">
  <composite-id>
    <key-property name="orderID" column="OrderID"/>
    <key-many-to-one name="productID" column="ProductID"   
              class="Products"/>
  </composite-id>
</class>


When I get collection "orderDetails", I have Exception:

detailMessage:
[Microsoft][ODBC Microsoft Access Driver] Duplicate output alias 'ProductID__'.

sql:
select orderdetai0_.productID as productID__, orderdetai0_.OrderID as OrderID__, orderdetai0_.ProductID as ProductID__, orderdetai0_.OrderID as OrderID0_, orderdetai0_.ProductID as ProductID0_ from [Order Details] orderdetai0_ where orderdetai0_.productID=?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 27, 2005 10:11 am 
Expert
Expert

Joined: Wed Apr 06, 2005 5:03 pm
Posts: 273
Location: Salt Lake City, Utah, USA
Probably a case-sensitivity problem. You have

Code:
<column name="productID"/>


in your Products mappping file, and

Code:
column="ProductID"


in your OrderDetails mapping file. Try making the case match.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.