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: Inheritance mapping - a problem with many-to-one association
PostPosted: Tue Oct 11, 2011 12:28 pm 
Newbie

Joined: Tue Oct 11, 2011 12:06 pm
Posts: 1
Hi to all,

I have this situation:

- class Entity that's the parent
- class SubEntity that's the child
- class AssociatedEntity that's an object with a bi-directional association whit SubEntity (1 to N from Sub to Associated)

Into AssociatedEntity I would to use a many-to-one association with SubEntity using the property-ref:

<many-to-one name="parentEntity" class="SubEntity" fetch="select" column="NAME" property-ref="ZONE"/>

the column "NAME" is a column of the AssociatedEntity's table and "ZONE" is a column of "SubEntity".

When I fetch the parentEntity on AssociatedEntity, the framework generates this into from clause:

select....
from
AssociatedEntity associatedentity0_
inner join
Entity entity1_
on associatedentity0_.NAME=entity1_.ZONE
and entity1_.type='SUB'
left outer join
SubEntity subentity1_1_
on entity1_.HINDENT=subentity1_1_.HINDENT

The problem is that ZONE isn't a column of Entity table but a column of SubEntity table.

Can anybody help me, please?


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.