-->
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.  [ 1 post ] 
Author Message
 Post subject: hibernate jpa spring
PostPosted: Thu Feb 18, 2010 9:08 am 
Newbie

Joined: Thu Feb 18, 2010 8:47 am
Posts: 1
Hi,

I have situation where in hiberate/jpa combination works fine without using spring. Exact same select query is fired but when used with spring it cannot find the column (using alias) but works fine without spring. Here is query:

select author0_.au_id as au1_0_4_, author0_.address as address0_4_, author0_.city as city0_4_, author0_.country as country0_4_, author0_.au_fname as au5_0_4_, author0_.au_lname as au6_0_4_, author0_.phone as phone0_4_, author0_.state as state0_4_, author0_.postalcode as postalcode0_4_, titles1_.au_id as au1_6_, title2_.title_id as title2_6_, title2_.title_id as title1_2_0_, title2_.advance as advance2_0_, title2_.contract as contract2_0_, title2_.notes as notes2_0_, title2_.price as price2_0_, title2_.pubdate as pubdate2_0_, title2_.pub_id as pub7_2_0_, title2_.title as title2_0_, title2_.total_sales as total9_2_0_, title2_.type as type2_0_, publisher3_.pub_id as pub1_3_1_, publisher3_.city as city3_1_, publisher3_.pub_name as pub3_3_1_, publisher3_.state as state3_1_, blurb4_.au_id as au1_1_2_, blurb4_.copy as copy1_2_, author5_.au_id as au1_0_3_, author5_.address as address0_3_, author5_.city as city0_3_, author5_.country as country0_3_, author5_.au_fname as au5_0_3_, author5_.au_lname as au6_0_3_, author5_.phone as phone0_3_, author5_.state as state0_3_, author5_.postalcode as postalcode0_3_
from authors author0_
left outer join titleauthor titles1_ on author0_.au_id=titles1_.au_id
left outer join titles title2_ on titles1_.title_id=title2_.title_id
left outer join publishers publisher3_ on title2_.pub_id=publisher3_.pub_id
left outer join blurbs blurb4_ on author0_.au_id=blurb4_.au_id
left outer join authors author5_ on blurb4_.au_id=author5_.au_id where author0_.au_id=?


The spring run exception is as below:
Caused by: java.sql.SQLException: S0022: Invalid column name 'title1_2_0_'.
at com.sybase.jdbc3.jdbc.ErrorMessage.raiseError(Unknown Source)
at com.sybase.jdbc3.tds.TdsResultSet.findColumn(Unknown Source)
at com.sybase.jdbc3.jdbc.SybResultSet.findColumn(Unknown Source)
at com.sybase.jdbc3.jdbc.SybResultSet.getString(Unknown Source)
at org.hibernate.type.StringType.get(StringType.java:41)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:184)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:173)
at org.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:1121)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:588)
at org.hibernate.loader.Loader.doQuery(Loader.java:724)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1881)
... 30 more

If any one already knows workaround please guide. If need more details like code please ask.

Regards,

Miten.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.