-->
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: PLS HELP with cassade delete many-to-many
PostPosted: Fri Apr 06, 2007 10:18 pm 
Newbie

Joined: Fri Apr 06, 2007 9:42 pm
Posts: 1
Hi, pls help me. For example: I have 2 processes. When Proces1 have WSDLs1, WSDLs2 WSDLs3 and process2 WSDLs4 WSDLs5 WSDLs6, deleting process1 is OK. But, when process1 : WSDLs1 WSDLs2 WSDLs3 and proces2: !! WSDLs3 !! WSDLs4 WSDLs5 and i want deleting process1, recieve error :(( Pls help me.Thnx.
update and save works ok.

Sorry for bad english ;)

Mapping documents:<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="bexee">
<class name="BPELProcess" table="TableBPELProcess">
<id name="ProcessName" column="PNAME" type="string">
<generator class="assigned"/>
</id>
<property name="BPEL" type="string" not-null="true"></property>
<property name="WSDL" type="string" not-null="true"></property>
<property name="Status" type="string"></property>
<set name="WSDLSet" table="P_W" cascade="all,delete-orphan">
<key column="PNAME"></key>
<many-to-many column="PWSDL" class="WSDLs"></many-to-many>

</set>

</class>
</hibernate-mapping>


<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="bexee">
<class name="WSDLs">
<id name="PartnerWSDL" column="PWSDL" type="string">
<generator class="assigned" />
</id>
</class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():package bexee;


import org.hibernate.Session;
import util.HibernateUtil;;

public class Test {

public static void main(String[] args) {

Test Testik = new Test();
Testik.TestWSDL();
HibernateUtil.getSessionFactory().close();
}

private void TestWSDL(){
Session session = HibernateUtil.getSessionFactory().openSession();
org.hibernate.Transaction tx = session.beginTransaction();
BPELProcess process = new BPELProcess();

session.load(process, "lukasko");
session.delete(process);
session.flush();

tx.commit();
}
}


Full stack trace of any exception that occurs:Hibernate: select bpelproces0_.PNAME as PNAME0_, bpelproces0_.BPEL as BPEL0_0_, bpelproces0_.WSDL as WSDL0_0_, bpelproces0_.Status as Status0_0_ from TableBPELProcess bpelproces0_ where bpelproces0_.PNAME=?
Hibernate: select wsdlset0_.PNAME as PNAME__, wsdlset0_.PWSDL as PWSDL__, wsdls1_.PWSDL as PWSDL0_ from P_W wsdlset0_ inner join WSDLs wsdls1_ on wsdlset0_.PWSDL=wsdls1_.PWSDL where wsdlset0_.PNAME=?

Hibernate: delete from P_W where PNAME=?
Hibernate: delete from WSDLs where PWSDL=?
Hibernate: delete from WSDLs where PWSDL=?
Hibernate: delete from WSDLs where PWSDL=?

org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92)
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:80)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:161)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:71)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:66)
at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:130)
at org.hibernate.persister.entity.BasicEntityPersister.delete(BasicEntityPersister.java:2019)
at org.hibernate.persister.entity.BasicEntityPersister.delete(BasicEntityPersister.java:2184)
at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:59)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:669)
at bexee.Test.CreateAndStorePartnerWSDL(Test.java:25)
at bexee.Test.main(Test.java:12)
Caused by: java.sql.BatchUpdateException: failed batch
at org.hsqldb.jdbc.jdbcStatement.executeBatch(Unknown Source)
at org.hsqldb.jdbc.jdbcPreparedStatement.executeBatch(Unknown Source)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:154)
... 14 more
Exception in thread "main"


Name and version of the database you are using:hsqldb


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 12, 2007 4:07 pm 
Newbie

Joined: Wed Feb 07, 2007 6:05 pm
Posts: 10
turn off batch update so you can get the real SQL error.

HSQLDB has a bug so it does not return the correct batch error.

You can either put this in your hibernate.cfg.xml

<!-- Disable batch updates -->
<property name="hibernate.jdbc.batch_size">0</property>

or patch hsqldb

add this else if clause to line 1084 org.hsqldb.Session.java

else if (in.mode == ResultConstants.ERROR) {
out = new Result(in.getException(), in.getMainString());
return out;


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.