-->
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.  [ 8 posts ] 
Author Message
 Post subject: Create SQL column not found
PostPosted: Sat Jul 24, 2004 7:59 pm 
Newbie

Joined: Fri Jul 09, 2004 3:01 pm
Posts: 7
I'm trying to create SQL Query. If I turn on show SQL and execute the SQL query 'directly' it works fine. But when I run it via Hibernate, I'm getting column not found, because it's append suffixes to all the column names. For example, it's looking for "ID0_" instead of "ID" or "{I}.ID"

If I alias the {I}.ID column as ID0_ I get past that column, and get the same problem on the next one.

Surely this is the way things are supposed to work. Help.

David


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 25, 2004 1:12 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
You are looking for projection of scalar values in createSQLQuery(). It looks like it is, but it actually isn't supported. We are on it for Hibernate3. Right now, you have to use direct SQL/JDBC via connection() or use HQL.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 25, 2004 6:47 am 
Newbie

Joined: Fri Jul 09, 2004 3:01 pm
Posts: 7
christian wrote:
You are looking for projection of scalar values in createSQLQuery(). It looks like it is, but it actually isn't supported. We are on it for Hibernate3. Right now, you have to use direct SQL/JDBC via connection() or use HQL.


"projection of scalar values"? If you say so....it just seems to me that query processing code is "poorly written" Why does it use such perverse aliases. -- specifically truncated so small -- ?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 25, 2004 6:48 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
I think it's time you read the documentation and figure out what those useless aliases do.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 25, 2004 9:06 am 
Newbie

Joined: Fri Jul 09, 2004 3:01 pm
Posts: 7
christian wrote:
I think it's time you read the documentation and figure out what those useless aliases do.


Well, I had read the documentation, just apparently the wrong documentation. And I never said they were useless. I've certainly done the query wrong, but I still think the aliases are "perverse" and am curious about the 'why of it.'? That is, why are the aliases 'truncated so'.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 25, 2004 10:26 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Uhm, _you_ write the aliases. You can use whatever verbose style you like.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 25, 2004 11:54 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Quote:
Why does it use such perverse aliases. -- specifically truncated so small


(1) uniqueness, when joining many tables
(2) the extremely small alias lengths supported by certain major platforms


Please don't accuse code you don't begin to understand of being "poorly written", unless you want to be banned from the user forum. TIA.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 25, 2004 1:43 pm 
Newbie

Joined: Fri Jul 09, 2004 3:01 pm
Posts: 7
christian wrote:
Uhm, _you_ write the aliases. You can use whatever verbose style you like.


I'm not talking about table aliases, I was talking about column aliases. When I had problems with "SELECT * " I originally enumerated each column, which required me to put "seemingly arbitrary" column aliases in place for Hibernate to fetch them from the resultset.. Changing my qurey to to use "SELECT {X.*},{Y.*}" corrected that problem.


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