-->
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.  [ 6 posts ] 
Author Message
 Post subject: Error in SQL Query after update to hibernate 3.5
PostPosted: Thu Apr 01, 2010 10:49 am 
Beginner
Beginner

Joined: Fri Aug 22, 2008 5:49 am
Posts: 22
I have an error after update to hibernate 3.5.
I get this Error: Column '_version' in field list is ambiguous
I have post the SQL Query from both version.

Has anybody an idea, what can i do? Thanks!

Before (Hibernate 3.2):
select
userroleim0_._dbid as column1_6_,
userroleim0_.idHigh as idHigh6_,
userroleim0_.idLow as idLow6_,
userroleim0_._version as column4_6_,
userroleim0_.defaultPartition_id as defaultP6_6_,
userroleim0_._gesperrt as column5_6_,
userroleim0_.user_id as user7_6_
from
resys_userrole userroleim0_, comm_user userimpl1_
where userroleim0_.user_id=userimpl1_._dbid and userimpl1_._loginname='admin';

After (Hibernate 3.5):
select
userroleim0_._dbid as column1_6_,
userroleim0_.idHigh as idHigh6_,
userroleim0_.idLow as idLow6_,
_version as column4_6_,
userroleim0_.defaultPartition_id as defaultP6_6_,
_gesperrt as column5_6_,
userroleim0_.user_id as user7_6_
from
resys_userrole userroleim0_ cross join comm_user userimpl1_
where userroleim0_.user_id=userimpl1_._dbid and _loginname='admin';


Top
 Profile  
 
 Post subject: Re: Error in SQL Query after update to hibernate 3.5
PostPosted: Tue Apr 06, 2010 12:21 pm 
Newbie

Joined: Tue Apr 06, 2010 12:13 pm
Posts: 2
Can't help you, but I'm having the same basic issue (or at least it looks the same). I have a column named "LENGTH" on two tables that are related (characteristic and characteristic_type). For some reason Hibernate 3.5 is leaving the table alias off the query, even though it's using the alias on other columns in the same table. It worked in the prior version.

(select list truncated)
SELECT
...
characteri1_.characteristic_type_id AS charact17_10_0_,
characteri1_.country_code AS country18_10_0_,
characteri1_.featured_dflt AS featured8_10_0_,
characteri1_.group_order AS group9_10_0_,
LENGTH AS length10_0_,
characteri1_.lss_chart_dflt AS lss11_10_0_,
characteri1_.name AS name10_0_,
characteri1_.profile_chart_dflt AS profile13_10_0_,
characteri1_.profile_graph_dflt AS profile14_10_0_,
...
characteri4_.characteristic_type_id AS characte1_7_3_,
characteri4_.row_entry_date AS row2_7_3_,
characteri4_.row_modify_date AS row3_7_3_,
characteri4_.row_task_id AS row4_7_3_,
characteri4_.row_user_id AS row5_7_3_,
LENGTH AS length7_3_,
characteri4_.name AS name7_3_,
characteri4_.selection_enabled AS selection8_7_3_,
country5_.country_code AS country1_1_4_,
country5_.row_entry_date AS row2_1_4_,
....
FROM br_seed.characteristic_data characteri0_,
br_seed.characteristic characteri1_,
br_seed.characteristic_grp characteri2_,
br_seed.crop crop3_,
br_seed.characteristic_type characteri4_,
br_seed.country country5_,
br_seed.crop crop6_,
br_seed.br_resource resourcefi7_,
br_seed.crop crop8_
WHERE characteri0_.characteristic_id = characteri1_.characteristic_id(+)
AND characteri0_.crop_id = characteri1_.crop_id(+)
AND characteri1_.characteristic_grp_id =
characteri2_.characteristic_grp_id(+)
AND characteri2_.crop_id = crop3_.crop_id(+)
AND characteri1_.characteristic_type_id =
characteri4_.characteristic_type_id(+)
AND characteri1_.country_code = country5_.country_code(+)
AND characteri1_.crop_id = crop6_.crop_id(+)
AND characteri1_.br_resource_id = resourcefi7_.br_resource_id(+)
AND characteri0_.crop_id = crop8_.crop_id(+)
AND characteri0_.crop_id = ?
AND characteri0_.seed_product_id = ?


Top
 Profile  
 
 Post subject: Re: Error in SQL Query after update to hibernate 3.5
PostPosted: Wed Apr 07, 2010 6:24 am 
Beginner
Beginner

Joined: Fri Aug 22, 2008 5:49 am
Posts: 22
maybe some developer kann see that thread :(


Top
 Profile  
 
 Post subject: Re: Error in SQL Query after update to hibernate 3.5
PostPosted: Wed Apr 07, 2010 10:59 am 
Newbie

Joined: Tue Apr 06, 2010 12:13 pm
Posts: 2
losdna,

Take a look at this bug:

http://opensource.atlassian.com/project ... e/HHH-4891

I came across it yesterday. It might be related to what you're seeing, though I don't know if the column names you have there fall into the same category. I managed to work around the issue by putting escaped quotes within the @Column annotation. @Column(name="\"LENGTH\"")


Top
 Profile  
 
 Post subject: Re: Error in SQL Query after update to hibernate 3.5
PostPosted: Thu Apr 08, 2010 6:33 am 
Beginner
Beginner

Joined: Fri Aug 22, 2008 5:49 am
Posts: 22
bkrodgers wrote:
losdna,

Take a look at this bug:

http://opensource.atlassian.com/project ... e/HHH-4891

I came across it yesterday. It might be related to what you're seeing, though I don't know if the column names you have there fall into the same category. I managed to work around the issue by putting escaped quotes within the @Column annotation. @Column(name="\"LENGTH\"")



Hi, thanks! It work's. I update this in mein annotation:
@Version
@Column(name = "\"_version\"")
private Integer _version; // Hibernate

But i don't know what the reason is. It worked very well in 3.3.2.


Top
 Profile  
 
 Post subject: Re: Error in SQL Query after update to hibernate 3.5
PostPosted: Thu Apr 08, 2010 9:50 am 
Beginner
Beginner

Joined: Fri Aug 22, 2008 5:49 am
Posts: 22
I create a similar Jira Issus with Testcase:

http://opensource.atlassian.com/project ... e/HHH-5086


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