-->
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: SQL Native by creatSQLQuery Bugs !!
PostPosted: Mon Mar 29, 2004 12:56 pm 
Beginner
Beginner

Joined: Mon Mar 29, 2004 12:41 pm
Posts: 26
Hi all,

I'm working with Oracle9i via JDBC and I've find a bug is the createSQLQuery method (I think it's a bug, perhaps i'm mistaking...).

Indeed, when I try this :
createSQLQuery("select {mytab.*} from MYTABLE {mytab} where {mytab.idtable}=1", "mytab", MyTable.class);

Hibernate generate a query like :
select MYTAB.IDTABLE AS IDTABLE0_, MYTAB.TABLENAME AS TABLENAME0_ [...] FROM MYTABLE MYTAB WHERE IDTABLE0_=1

It generates an JDBC error ORA-00904 : Invalid indentifier. It's true, because IDTABLE0_ doesn't exist in the table MYTAB, but IDTABLE does... so it's a bug i think, isn't it ?? Hibernate might use MYTAB.IDTABLE-like expressions in the where clause...

What do you think about it people ?

Thanks !! =)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 29, 2004 4:17 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
that is not an error - {}-syntax is just for aliases...and if the db does not support aliases in the where clause then use the direct table/column name instead...

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 30, 2004 3:46 am 
Beginner
Beginner

Joined: Mon Mar 29, 2004 12:41 pm
Posts: 26
Hi Max ! =)

Following your post, I've tried this one :

createSQLQuery("select {mytab.*} from MYTABLE {mytab} where {mytab}.IDTABLE=1", "mytab", MyTable.class);

And it worked fine !! =D

Thanks !!

-TEUF-


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.