-->
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: How to map such relation in mapping file, thanks
PostPosted: Thu Mar 11, 2004 5:31 am 
Newbie

Joined: Thu Mar 11, 2004 5:13 am
Posts: 5
Example:
Class A extend B implements C {
}

In mapping file:
<class name="B" table="B">
<id>... </id>
<joinedsubclass name="A" table="A">
<key column="B_ID">
.....
</joinedsubclass>
</class>

Then how to implement the relation between Class A and Interface C ?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 11, 2004 5:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
C is introducing properties that are mapped just as if the interface was not used. Its the same as if you included the properties in A and they were not an interface implementation. The mapping does not care about the fact the some of the properties match an interface declaration.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 11, 2004 10:14 am 
Newbie

Joined: Thu Mar 11, 2004 5:13 am
Posts: 5
First, thanks for your reply
In fact I confronted with the problem of implement a kind of multi-inherit
relation in mapping file.

For example, classImpA implement classA extend classImpB
and classA extend classC classImpC implement classC

In mapping file
ClassImpA is decleared as jontsubclass of ClassImpB and has follow statement.
<many-to-one name="xxx" class="ClassImpC">
In fact classA is subclass of classC
But since I don't know how to declare such relation in mapping file
so when I excute follow statement :

facade.setup()

ClassA a = new ClassA();
xxx.setXXX(a); ------ the method is defined as setXXX(ClassC c)

facade.store(xxx);

I got the error message:
Insert and Update of table "ClassC" is violate to the constraint key ...
Because ClassA is not looked as subClass of ClassC

Does anyone know how to solve such problem without changing inherit
structure.

Thanks a lot


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.