-->
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: Inverse mappings for <any> associations.
PostPosted: Tue Mar 08, 2005 8:42 am 
Newbie

Joined: Tue Mar 08, 2005 8:00 am
Posts: 10
I have an "Attachment" persistent class, that can be attached to multiple parent classes.
We decided to use an <any> mapping to identify the parent of the Attachment (we evaluated using inheritance, but it'll complicate class hierarchy quite a bit).
In Hibernate 2.1.8 everything worked well.
In Hibernate 3.0rc1, SchemaExport generate wrong foreign key constraints, one for any possible destination of the <any> mapping:

alter table ATTACHMENT add constraint FKA7E14523E1190749 foreign key (PARENT_FK) references WPR

alter table ATTACHMENT add constraint FKA7E14523CDF83409 foreign key (PARENT_FK) references PROJECT

It doesn't happens if I remove the inverse mapping in Project and WorkProgressReport, but I need inverse mappings.

It's not possible to have an inverse association for <any> mappings?

Hibernate version: 3.0 rc1

Mapping documents:

Attachment.xml

...
<any name="parent" id-type="int" meta-type="string">
<meta-value value="PJT" class="mymodel.ARITpm.hibernate.Project"/>
<meta-value value="WPR" class="mymodel.ARITpm.hibernate.WorkProgressReport"/>
<column name="PARENT_TYPE" not-null="true"/>
<column name="PARENT_FK" not-null="true"/>
</any>
...

WorkProgressReport.xml and Project.xml

...
<set
name="attachments"
lazy="true"
inverse="true"
cascade="all-delete-orphan"
>
<key
column="PARENT_FK"
/>

<one-to-many
class="mymodel.ARITpm.hibernate.Attachment"
/>
</set>
...

Name and version of the database you are using: Oracle 10g


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 09, 2005 7:01 am 
Newbie

Joined: Tue Mar 08, 2005 8:00 am
Posts: 10
It is a known problem?
It is a wrong usage of Hibernate?
I have to submit it in JIRA?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 21, 2005 10:25 am 
Beginner
Beginner

Joined: Fri Apr 09, 2004 12:47 pm
Posts: 36
I'm interested in this topic too, since I'm going to make an any mapping with a bidirectional association. For the moment I'm using Hibernate 2, so it seems to be no problem (I'm stuck with it since I'm using JBPM 2.0), but I'm worried about the future... did you find any solution?


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.