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: "AS" before column aliases in select clause
PostPosted: Wed Jan 07, 2004 7:03 am 
Newbie

Joined: Wed Jan 07, 2004 6:42 am
Posts: 3
I'm using Hibernate in a WebLogic - DB2/VSE environment.

I noticed that the SQL generated by Hibernate always contains "as" before column aliases in the select clause. This seems not to be supported by our version of DB2/VSE (mainframe):
Hibernate: select paritairco0_.TAAL_CODE as TAAL_CODE0_, paritairco0_.CPGM_NAAM as CPGM_NAAM0_ from CB.T170TAAL paritairco0_ where paritairco0_.TAAL_CODE=?

The db2 driver returns an error:
[WARN] JDBCExceptionReporter - -SQL Error: -104, SQLState: 42601
[ERROR] JDBCExceptionReporter - -[IBM][CLI Driver][SQLDS/VSE] SQL0104N An unexpected token "AS" was found following "TAAL_CODE". Expected tokens may include: "". SQLSTATE=42601


This is clearly related to our version of DB2 cause it works fine on DB2/NT. The DB2Dialect doesn't change anything on this behavior. The "as" seems to be hardcoded in SelectFragment.toFragmentString(). Are there any means to skip the "as" and produce something like:
select paritairco0_.TAAL_CODE TAAL_CODE0_,....

I'd like to have your opinion on this.

Kind regards,
Gert

[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 07, 2004 9:01 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
As you said, this is hardcoded, but should be easy to patch if you build hibernate from source. Feel free to submit a JIRA entry to make this configurable. I am however quite surprised your DB2 does not support this, this is really basic SQL standard.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 07, 2004 9:45 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
If you patch that, implement that using the Dialect classes

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 09, 2004 5:28 pm 
Newbie

Joined: Wed Jan 07, 2004 6:42 am
Posts: 3
In fact it's even worse than I thought... DB2/VSE doesn't support any column aliases at all. Patching this in the select clause won't be difficult.

I'm not sure what the consequences are when DB2/VSE is not supporting column aliases. Which approach should be taken in order to make it work with Hibernate? In the Hibernate reference (15.2):

15.2. Alias and property references
The {cat.*} notation used above is a shorthand for "all properties". You may even list the properties explicity,but you must let Hibernate provide SQL column aliases for each property.

How does this relate to the column alias issue?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 09, 2004 11:48 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Quote:
DB2/VSE doesn't support any column aliases at all.


wtf???! This can't possibly be correct .... can it?



(You will not be able to make Hibernate work without the use of column aliases.)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 10, 2004 5:08 am 
Newbie

Joined: Wed Jan 07, 2004 6:42 am
Posts: 3
I'm afraid it IS true. I asked the DBA's about it.

OK, we'll use Hibernate then when we have a decent database system ;-)


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.