-->
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: Inheritance
PostPosted: Wed Jan 17, 2007 3:10 pm 
Newbie

Joined: Wed Jan 17, 2007 2:48 pm
Posts: 1
I have a class B which extands class A. I am writing a HQL using these two classes. In B's mapping file i have only B's fields. When I execute the HQL A is replaced with B and I am getting exception that the field info is not found.

like
SELECT a,b,c

FROM

A a, B b, C c

Where

a.id = c.id
AND c.id = b.id

is interprated as

SELECT a,b,c

FROM

B a, B b, C c

Where

a.id = c.id
AND c.id = b.id

How do I mention in B's mapping file that A's info is in A's mapping? I can't change the class structure for any reason.

The hibernate version is 2.1.7

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 17, 2007 11:31 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Assuming that you have auto-import="true" in your configuration file, you don't need to mention A in B's mapping file unless you want to alias A.

If you're seeing B's table when you query on A, it's most likely due to the way you've declared the inheritance in your mapping. Perhaps you've accidentally said that A's mapping extends B, instead of the other way around. You'll probably have to post your mappings for a more detailed analysis.

_________________
Code tags are your friend. Know them and use them.


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.