-->
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: <any> problems - duplicate column problems
PostPosted: Wed Dec 10, 2003 1:31 pm 
Regular
Regular

Joined: Tue Dec 02, 2003 6:25 pm
Posts: 61
Location: Dallas, TX
Having problems with a one-to-any relationship where the "foreign key column" is the same as my id column.

After some refactoring the stuff I asked about in this post, Hibernate is choking on duplicate columns inside my <any> mapping, and it doesn't seem like there is a way to configure those column mappings so that insert="false" update="false"

Here is the mapping:

Code:
<class name="com.orixcm.prism.business.TPPropertyReport" table="third_party_property_report" >
      <id name="id" type="long" unsaved-value="null" >
          <column name="third_party_property_report_id" sql-type="int" not-null="true"/>
          <generator class="identity"/>
      </id>   
      <property name="vendorName" column="vendor_name" />
      <many-to-one name="type" column="third_party_property_report_type_id"/>
      <any name="reportDetail" id-type="long" meta-type="com.orixcm.prism.business.CustomTypeMapper" >       
         <column name="third_party_property_report_type_id" />
         <column name="third_party_property_report_id"/>
      </any>
...

One of my <any> classes:

Code:
   <class name="com.orixcm.prism.business.Appraisal" table="appraisal">
      <id name="id" type="long" unsaved-value="null" >
         <column name="third_party_property_report_id" sql-type="int" not-null="true"/>
         <generator class="foreign">
            <param name="property">report</param>
         </generator>
      </id>      
      <property name="valuationAmount" column="valuation_amount"></property>
...


So, Hibernate sees:

Code:
<many-to-one name="type" column="third_party_property_report_type_id"/>

and then it gets to my <any> mapping and sees
Code:
<column name="third_party_property_report_type_id" />

And Hibernate decides that one of those column mappings MUST disallow updates, so it stops and tells me so.

The problem is that the only place to disallow updates is on the "type" property mapping, which is exactly where I need to be able to do updates. It's the <any> mapping that I want to set that column to insert="false" update="false".

Also, the same thing happens for my second column mapping in the <any>, because it is the same column that is used as the id for my persistent class (because it is a one-to-one relationship with the <any> class):
Code:
<column name="third_party_property_report_id"/>


Clearly, I can't and wouldn't want to declare my <id> to be insert="false" update="false".

So I'm pretty stuck.

Any ideas / workarounds anyone?


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.