-->
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: A trouble with generated SQL by Hibernate
PostPosted: Wed Nov 03, 2004 10:44 pm 
Newbie

Joined: Wed Nov 03, 2004 8:51 pm
Posts: 4
Hibernate version:
2.1.6

I'm using a stupid RDBMS which has a bug with alias name in Select statement.

When I use hibernate for one-to-many mapping with non-lazy initialization, this bug brings me trouble.
The generated SQL is like the following:

The generated SQL (show_sql=true):

select instances0_.FACTORY_ID as FACTORY_ID__, instances0_.ID as ID__, instances0_.ID as ID0_, instances0_.URI_KEY as URI_KEY0_, instances0_.STATE as STATE0_, instances0_.NAME as NAME0_, instances0_.SUBJECT as SUBJECT0_, instances0_.DESCRIPTION as DESCRIPT6_0_, instances0_.CONTEXT_DATA as CONTEXT_7_0_, instances0_.RESULT_DATA as RESULT_D8_0_, instances0_.FACTORY_ID as FACTORY_ID0_, instances0_.WORKFLOW_INSTANCE_ID as WORKFLO10_0_ from T_ASAP_INSTANCE instances0_ where instances0_.FACTORY_ID=?

Both FACTORY_ID__ and FACTORY_ID0_ point to the column of FACTORY_ID. But the stupid RDBMS which I use ommits the first alias name, and only the latter can be accessed from the returned ResultSet.

So Hibernate cannot get the Key for parent (one side) from the resultset of the child(many side). Then Exception occurs.

I hate the RDBMS I am using. But how can I deal with it. I have no ideas.
Anyone could give me some light?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 04, 2004 4:02 am 
Expert
Expert

Joined: Thu Jan 29, 2004 2:31 am
Posts: 362
Location: Switzerland, Bern
AFAIK there's a problem with aliases and Sybase. As far I can remember this is fixed in CVS. Maybe using the nightliy snap shot (the commint 2.1.7) solves your problem.

HTH
Ernst


Top
 Profile  
 
 Post subject: curious thing...
PostPosted: Thu Nov 04, 2004 10:49 pm 
Newbie

Joined: Wed Nov 03, 2004 8:51 pm
Posts: 4
I got the hibernate 2.1.7 snapshot but things not change.
And I 'm curious about why Hibernate use different alias name for the same column if the column acts as FK for one-to-many mapping.
What's the underlying rational for this?


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.