Hello to everyone,
I am using Appfuse 1.9.4 and Webwork. I have 2 hbm.xml files that I
wrote like this:
<hibernate-mapping>
<class name="com.voxsant.thinkscan.model.Image" table="image">
<id name="id">
<generator class="native"/>
</id>
.....
<set name="studies" inverse="true" cascade="all">
<key column="parent_image" on-delete="cascade"/>
<one-to-many class="com.voxsant.thinkscan.model.Study" />
</set>
</class>
</hibernate-mapping>
<hibernate-mapping>
<class name="com.voxsant.thinkscan.model.Study" table="study">
<id name="id">
<generator class="native"/>
</id>
.....
<many-to-one name="parentImage"
class="com.voxsant.thinkscan.model.Image"
cascade="save-update" lazy="false"
column="parent_image"/>
.....
</class>
</hibernate-mapping>
Here are the problems:
1. When I delete an Image which is a parent object, I received an error
like this:
Could not execute JDBC batch update; nested exception is
org.hibernate.exception.ConstraintViolationException: Could not execute
JDBC batch update
I expect that when I delete a parent object, the child objects will be
also deleted like Image member on my Study object. Do I have an error on
my hibernate mapping?
2. Why I cannot catch
org.hibernate.exception.ConstraintViolationException using this code:
try{
imageManager.removeImage(x);
} catch (ConstraintViolationException c) {
log.debug("ERROR on CONSTRAINT");
}
It always displays "Could not execute JDBC batch update; nested
exception is org.hibernate.exception.ConstraintViolationException: Could
not execute JDBC batch update".
Thanks in advance.
Adriel
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]