-->
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: joined-subclass hsql
PostPosted: Fri Aug 13, 2004 7:54 am 
Newbie

Joined: Wed Jul 28, 2004 11:16 am
Posts: 6
Location: Australian in Ireland
Hi

I am wondering if it is possible to use the class type in the where clause for a joined-subclass or table per subclass hierarchy

one of the HSQL examples in the doco at 11.7 is
from eg.Cat cat where cat.class = eg.DomesticCat

and states that the "... a java class name embedded in the where clause will be translated to its discriminator value"

my assumption here is that this type of query will only work with the table per class hierarchy where there is a discriminator column to query. Is this correct or is there a way i can do this with a joined-subclass heiracy.

I have tried this type of query with the joined-subclass and it just returns an empty result. Before i go on i just want to know if it is possible. If not an alternative.

thanks
Simon


Hibernate version:Hibernate 2.1.1

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:n/a

Name and version of the database you are using:MySQL 4.1.2-alpha-nt

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 13, 2004 8:33 am 
Regular
Regular

Joined: Mon Oct 06, 2003 7:17 am
Posts: 58
Location: Switzerland
No, it is not possible. The discriminator works not for joined-subclasses. Try
Code:
from eg.DomesticCat cat


Reto


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 13, 2004 8:53 am 
Newbie

Joined: Wed Jul 28, 2004 11:16 am
Posts: 6
Location: Australian in Ireland
right thanks.

I was going to use named queries from my mapping files like

from FreightHub as hub where
hub.class = :subclass and
hub.region = :region

i guess ill just have to duplicate my named queries for each subclass or come up with a better idea :)

thanks for the quick reply

Simon


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.