-->
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.  [ 1 post ] 
Author Message
 Post subject: Querying Inheritance-based tables
PostPosted: Sun Sep 28, 2008 6:25 pm 
Newbie

Joined: Sun Sep 28, 2008 6:10 pm
Posts: 6
Hi, I'm new to hibernate and I want to know if this is possible:

@MappedSuperclass
abstract class generalClass

-string name

---------------------------------

class firstNarrowClass extends generalClass

@Id
-long id

----------------------------------

class secondNarrowClass extends generalClass

@Id
-long id


Here are my classes. From these classes, when I try to use HQL and execute the statement "FROM generalClass", it doesn't give me the right result. I have looked into the StrategyType JOINED but this only works if the abstract class have the id field. I'm trying to get two different tables with their own id fields instead of the super class holding it. Also, I tried doing "FROM firstNarrowClass UNION FROM secondNarrowClass" but this does not work also. Does anybody know of a way to achieve this? Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.