-->
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: Trouble to map multi level complex table
PostPosted: Thu Apr 12, 2007 11:43 pm 
Newbie

Joined: Thu Apr 12, 2007 11:25 pm
Posts: 1
Hi,
I have been struggling to map a multi level complex table.
Here is my class A contains List of B and B contains List of C.

class A{
int a;
List<B> bList;
..
}
class B{
int b;
List<C> cList;
..
}
class C{
int c;
..
}

Here is my mapping sql

<class name="A" table="TABLE_A">
<id name="a" column="COL_A">
<generator class="increment"/>
</id>
<list name="bList" lazy="false" cascade="all">
<key column="b"/>
<index column="IDX"/>
<one-to-many class="B"/>
</list>
<property name="index" column="IDX" type="integer"/>
</class>

<class name="B" table="TABLE_B">
<id name="b"
column="COL_B">
<generator class="increment"/>
</id>
<list name="cList" lazy="false" cascade="all">
<key column="c"/>
<index column="IDX"/>
<one-to-many class="C"/>
</list>
<property name="index" column="IDX" type="integer"/>
</class>
<class name="C" table="TABLE_C">
<id name="c" column="COL_C">
<generator class="increment"/>
</id>
<property name="index" column="IDX" type="integer"/>
</class>

Got the following error
SEVERE: Exception executing batch:
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

What's wrong with about mapping? Please guide me.

Thanks
Raj


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 13, 2007 12:21 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Don't know if this is what's causing your error, but you've made IDX writable in two places, which is definitely an error. Change all <property> elements to
Code:
<property name="index" column="IDX" type="integer" insert="false" update="false"/>
or to
Code:
<property name="index" formula="IDX" type="integer"/>

_________________
Code tags are your friend. Know them and use them.


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.