-->
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.  [ 3 posts ] 
Author Message
 Post subject: column ambiguously defined error when using Oracle database
PostPosted: Fri Feb 03, 2006 10:43 am 
Newbie

Joined: Fri Feb 03, 2006 10:21 am
Posts: 3
I am using hibernate with oracle databases.
My HBM file has many to one mapping defined.
For pagination i am setting the setMaxResults(Integer i)
query generated by Hibernate is in following format:
Select * from (select ...) where rownum <= i;
select query genrated has duplicate column names
and gives the error
Column ambiguously defined.


Top
 Profile  
 
 Post subject: Re: column ambiguously defined error when using Oracle datab
PostPosted: Fri Feb 03, 2006 10:55 am 
Newbie

Joined: Wed Apr 27, 2005 3:09 pm
Posts: 5
Check column names case.

You may call:
select x as 'x', X as 'x' from table;
But you cannot (in oracle):
select count(*) from (select x as 'x', x as 'X' from table);

Here is JIRA issue:
http://opensource2.atlassian.com/projec ... e/HHH-1110

Check your hbm files, probably you have somthing like this:

<property name="phoneId" column="PHONE_ID" type="integer" not-null="false" />
<many-to-one name="phone" class="my.domain.Phone" column="phone_id" />

Hamster,


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 2:16 am 
Newbie

Joined: Fri Feb 03, 2006 10:21 am
Posts: 3
Hello,

My hbm files have entry like this

<class name="com.tfsm.oas.data.Location" table="Location">
<property name="siteKey" column="SiteKey" type="int" />
<many-to-one name="site" class="com.tfsm.oas.data.Site" column="SiteKey" insert="false" update="false" lazy="false"/>
</class>

And the query generated is as follows:

select * from ( select location0_.SiteKey as SiteKey86_, location0_.SiteKey as siteKey86_ from Location location0_, Site site1_ where site1_.SiteKey=location0_.SiteKey and location0_.AccountKey=1 order by location0_.LocationKey asc ) where rownum <= 4

In the inner select query there are 2 location0_.SiteKey columns selected which gives error.
To solve this either
1) The second column selected should be site1_.SiteKey.
or
2) I should be able to give a different alias name for the second sitekey selected.

Could anyone pls tell me how get these 2 ponts done in hibernate?


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