-->
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.  [ 2 posts ] 
Author Message
 Post subject: Wrong HQL generated with joined-subclass?
PostPosted: Thu Oct 20, 2005 5:43 am 
Newbie

Joined: Wed Apr 20, 2005 4:14 am
Posts: 10
Location: Netherlands
I have a problem with HQL-code generated from a joined-subclass. I believe there are a few braces missing. And this makes the DB swap around for hours.

Hibernate version:
3.05

Mapping documents:
Code:
<class name="Entiteit" table="entiteit">
      <id   name="Id" column="id000" type="long" unsaved-value="-1"> <generator class="increment"/> </id>
      <version name="Version" column="ve000" unsaved-value="negative"/>

      <property name="Identification" column="a1103" type="string" length="14"/>
      
      <!-- SpecializedEntity part -->
      <joined-subclass name="SpecializedEntity" table="specializedentity">
         <key column="id117"/>
         <property name="Name" column="a1170" type="string" length="80" />
      </joined-subclass>
   </class>


Name and version of the database you are using:
Oracle 9.2

The generated SQL (show_sql=true):
When I make an HQL like this:
Code:
from SpecializedEntity where (Name='John' or Name='Pete')

the following SQL is generated:
Code:
select (bunch of fields) from Entity e, SpecializedEntity s
where s.name='John' or s.name='Pete' and s.id117=e.id000


I believe this should be:
Code:
select (bunch of fields) from Entity e, SpecializedEntity s
where (s.name='John' or s.name='Pete')
  and s.id117=e.id000


It his a bug, or am I expecting something wrong?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 21, 2005 4:50 am 
Newbie

Joined: Wed Apr 20, 2005 4:14 am
Posts: 10
Location: Netherlands
The subject should be 'wrong SQL', not 'wrong HQL'. ;-)

Is there really no-one who can give me a clue?

The query that Hibernate generates is really really really bad performing, and will give wrong output (I've never even had enough patience to let it end..), whereas the query that I except is finished in the wink of an eyebrow.


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