-->
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.  [ 13 posts ] 
Author Message
 Post subject: Generated SQL identifier too long in 2.1b6
PostPosted: Mon Nov 10, 2003 9:09 pm 
Beginner
Beginner

Joined: Mon Sep 29, 2003 10:32 pm
Posts: 35
Location: Toronto, Ontario
I am doing a select from a table, with an column called COLLECTORATE_CODE which is 17 characters long.
In version 2.0.3 the following SQL is generated.

select applicat0_.COLLECTORATE_CODE as COLLECTORATE_CODE,
[other columns .......] from TCC.APPLICATION applicat0_ where applicat0_.COLLECTORATE_CODE=?

When I switched to using 2.1b6 the following is generated
select applicat0_.COLLECTORATE_CODE as COLLECTORATE_CODE0_,
[other columns .......] from TCC.APPLICATION applicat0_ where applicat0_.COLLECTORATE_CODE=?

Now the alias for COLLECTORATE_CODE has 19 characters, which is too long for Informix 7, the database server that we are using.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 10, 2003 9:15 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
uggghhhh. ummmm. what kind of mapping is collectorate_code? It must by the PK, I suppose....


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 11, 2003 9:38 am 
Beginner
Beginner

Joined: Mon Sep 29, 2003 10:32 pm
Posts: 35
Location: Toronto, Ontario
Yes. The mapping is as follows
<class
name="org.fsl.references.tcc.Application"
schema="TCC"
table="APPLICATION"
mutable="false">

<composite-id
name="applicationPK"
class="org.fsl.references.tcc.ApplicationPK" >

<key-property name="collectorateCode" column="COLLECTORATE_CODE" type="string" />
<key-property name="applicationNumber" column="APPL_SNO" type="integer"/>
<key-property name="year" column="YEAR_NBR" type="integer"/>

</composite-id>


<property name="trn" column="TRN_NBR" type="integer"></property>
<property name="branch" column="BRANCH_NBR" type="integer"></property>

</class>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 11, 2003 10:00 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Damn this could be a problem. I don't recall making this change. Shit.

This gives me something to think about.


Top
 Profile  
 
 Post subject: Column alias generation; Informix 7; joins
PostPosted: Thu Nov 13, 2003 11:34 am 
Newbie

Joined: Thu Nov 13, 2003 11:27 am
Posts: 4
We're using Informix 7 with Hibernate 2.03 also. One issue that has always been a problem, even with 2.03, is joining where one column name is close to 18 characters long. For example, in a one-to-many relationship, etc. Hibernate generates a column alias that is longer than 18 characters in those cases.

I've been off-list for a while; any changes in the 2.1 beta alias generation that might help here?

Thanks.

_________________
Steve


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 11:35 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Nope, the problem still exists for identifier and discriminator columns.


Top
 Profile  
 
 Post subject: Alias generation for discriminator, identifier columns
PostPosted: Thu Nov 13, 2003 11:38 am 
Newbie

Joined: Thu Nov 13, 2003 11:27 am
Posts: 4
How hard is it to fix? I looked into doing a patch a while ago; got a little lost looking at the code and gave up. Can't remember the details.

Where should I start looking?

_________________
Steve


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 11:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Yeah its hard. But you would be my best friend ;-) It really is one of our longest-running issues.

You basically "just" need to make generation of identifier column aliases work the same as other properties. Its possible, and it would be a good way to learn the internals of Hibernate.

Note that the implementation of the alias-generation stuff is NOT the greatest thing in Hibernate. Max hates it.


Top
 Profile  
 
 Post subject: Best Friend
PostPosted: Thu Nov 13, 2003 3:37 pm 
Beginner
Beginner

Joined: Mon Sep 29, 2003 10:32 pm
Posts: 35
Location: Toronto, Ontario
You'd be my best friend as well, as we'd like to move to 2.1 release when its ready, and if the 2.0.3 fails on one of the tables, we'd be screwed.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 5:05 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
gavin wrote:
Max hates it.


It's black can't-see-through magic!

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 27, 2003 9:04 am 
Newbie

Joined: Wed Nov 26, 2003 10:07 am
Posts: 3
I am happy to find this subject. the analys matches exactly mine,
hibernate seems to shorten long columname aliases but fails to do so on id fields.
Has anyone come further in fixing this? Or do I have to start from the beginning if I want to resolve it? I am not familiar with the hibernate source, so I would be happy with any hint.
Quote:
It really is one of our longest-running issues

is there a bug registered? you know the number?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 27, 2003 12:46 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
http://opensource.atlassian.com/project ... key=HB-244


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 27, 2003 7:45 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Go there again - now with a possible patch ;)

If someone could test it I would appreciate it ;)

_________________
Max
Don't forget to rate


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