-->
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.  [ 2 posts ] 
Author Message
 Post subject: one-to-one throws an Exception when flushed
PostPosted: Wed Mar 02, 2005 12:29 pm 
Newbie

Joined: Wed Jan 19, 2005 2:24 pm
Posts: 9
Hibernate version:
2.1.6

Mapping documents:

<class name="Process" table="workflow_process">
<id name="id" column="id" type="java.lang.Long" unsaved-value="null">
<generator class="increment"/>
</id>
<one-to-one name="accounting" class="ProcessAccounting" cascade="save-update"/>

<joined-subclass name="Casting" table="workflow_pr_casting">
<key column="id"/>
</joined-subclass>
</class>

<class name="ProcessAccounting" table="workflow_pr_acc" >
<id name="id" column="id" type="java.lang.Long" unsaved-value="null">
<generator class="foreign">
<param name="property">process</param>
</generator>
</id>
<one-to-one name="process" class="Process" constrained="true"/>
</class>

Code between sessionFactory.openSession() and session.close():
Process pr = // get from somewhere (type Casting)
session.saveOrUpdate(pr);
logger.debug("pr id == " + pr.getId());
ProcessAccounting pa = new ProcessAccounting();
pa.setProcess(pr);
pr.setAccounting(pa);
Full stack trace of any exception that occurs:

Hibernate does not report any problems but saves both one-to-one-related entities with different IDs (both are incremented independently).
Does joined-subclass have anything to do with this?

Name and version of the database you are using:

MySQL 4.1


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 02, 2005 12:43 pm 
Newbie

Joined: Wed Jan 19, 2005 2:24 pm
Posts: 9
Error in Subject: Hibernate Does not throw an exception but saves a wrong ID


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.