-->
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: Circular reference on inheritance and one-to-one mapping
PostPosted: Fri Feb 13, 2009 9:46 am 
Newbie

Joined: Fri Feb 13, 2009 9:37 am
Posts: 1
Hello,

I have problems configuring some relationships. I have class SimplePrice and class RolledPrice, the second inherits the first.
The cofiguration file is like this:

Code:
<class name="SimplePrice">

   <id name="id" type="long" column="simplePrice_id">
    <generator class="sequence"/>
   </id>
  ...
  <joined-subclass name="RolledPrice">
     <key column="simplePrice_id"/>
     <one-to-one class="SimplePrice" name="contractPrice"/>
  </joined-subclass>

</class>


What happens is that I have a new instance "a" of type "RolledPrice" and I assign to the "contractPrice" property a "SimplePrice" instance (that's already persisted, with the id 100 for example), after that I call "hibernateTemplate.persist(a)". Later when I retrieve the "RolledPrice" instance added before (for example now it has id 1001), it has a reference to itself in the property "contractPrice", instead of a "SimplePrice" instance with the id 100.

This happens during a JUnit test, using Spring and in-memory HSQLDB.

Could someone tell me what am I doing wrong?

Thank you,


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.