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: Indexed list with association table: Removals sometimes fail
PostPosted: Wed Sep 27, 2006 1:00 pm 
Beginner
Beginner

Joined: Tue Oct 05, 2004 5:15 am
Posts: 23
Ive got Clients and Books.
Clients have a list of Books which they are "borrowing".
This is a <list> with a join table (mappings below).
I've got an index (=IDX) column to manage the list index.

Something very wierd is happening when remove Books from a Client:

Say I add 4 books to the Clients List.
I can then successfully remove the 3rd and 4th books in the list - but not the 1st or 2nd.
(All I can get from the exception is "org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update").

After I remove either the 3rd or the 4th book - I can then remove the 2nd book - but not the first.
If I remove both the 3rd and 4th books - I can then remove both the 1st and 2nd books.

Can any one give me any tips on why this might happen?

Dave


Hibernate version:
Hibernate 3

Mapping documents:

<hibernate-mapping package="x.y.z.model">

<class name="Client" table="CLIENT" lazy="false">
<id name="id" column="ID" access="field">
<generator class="native"/>
</id>
<property name="name" column="NAME"
access="field" unique="true" not-null="true"/>

<list name="borrowedBooks" access="field" lazy="false" table="CLIENTBOOKS">

<key column="CLIENTID"/>
<index column="IDX"/>
<many-to-many class="Book" column="BOOKID" unique="true"/>

</list>

</class>

</hibernate-mapping>

<hibernate-mapping package="x.y.z.model">

<class name="Book" table="BOOK" lazy="false">
<id name="id" column="ID" access="field">
<generator class="native"/>
</id>
<property name="name" column="NAME"
access="field" unique="true" not-null="true"/>

<property name="status" column="STATUS"
access="field" not-null="true">
<type name="org.hibernate.type.EnumType">
<param name="enumClass">x.y.z.BookStatus</param>
</type>
</property>

<property name="category" column="CATEGORY"
access="field" not-null="true">
<type name="org.hibernate.type.EnumType">
<param name="enumClass">x.y.z.BookCategory</param>
</type>
</property>

</class>

</hibernate-mapping>

DB = HSQLDB (server mode)


Top
 Profile  
 
 Post subject: Solved it...
PostPosted: Wed Sep 27, 2006 2:13 pm 
Beginner
Beginner

Joined: Tue Oct 05, 2004 5:15 am
Posts: 23
It was a unique contraint on CLIENTBOOKS (IDX)


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.