[jboss-user] [JBoss jBPM] - can't delete a taskinstance from my database

galvino do-not-reply at jboss.com
Tue Aug 7 11:27:21 EDT 2007


hi, i want to delete a task instance from my database (mysql).

this is my source code:

  | Connection connection=jbpmContext.getConnection();
  | 			Statement statement=connection.createStatement();
  | 			
  | //			écriture de la requête de recherche
  | 			request="DELETE "
  | 				+ "FROM jbpm_taskinstance " 
  | 				+ "WHERE id_='"
  | 				+ taskInstanceId + "'";
  | 			
  | //			execution de la requête
  | 			statement.execute(request);
  | 			
  | //			fermeture de la connection à la base de données
  | 			statement.close();
  | 			connection.close(); 
  | 			
  | 

but i doesn't work because, i think it doesn't execute query :

  | statement.execute(request);
  | 
i tried statement.executeUpDate(request); 
but i have the same error:


  | 
  | com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`paolo/jbpm_log`, CONSTRAINT `FK_LOG_TASKINST` FOREIGN KEY (`TASKINSTANCE_`) REFERENCES `jbpm_taskinstance` (`ID_`))
  | 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:931)
  | 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2934)
  | 	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1616)
  | 	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1708)
  | 	at com.mysql.jdbc.Connection.execSQL(Connection.java:3249)
  | 	at com.mysql.jdbc.Connection.execSQL(Connection.java:3178)
  | 	at com.mysql.jdbc.Statement.execute(Statement.java:711)
  | 	at BesoinJBpm.deleteTaskInstance(BesoinJBpm.java:361)
  | 	at BesoinJBpm.Test(BesoinJBpm.java:55)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  | 	at java.lang.reflect.Method.invoke(Unknown Source)
  | 	at junit.framework.TestCase.runTest(TestCase.java:154)
  | 	at junit.framework.TestCase.runBare(TestCase.java:127)
  | 	at junit.framework.TestResult$1.protect(TestResult.java:106)
  | 	at junit.framework.TestResult.runProtected(TestResult.java:124)
  | 	at junit.framework.TestResult.run(TestResult.java:109)
  | 	at junit.framework.TestCase.run(TestCase.java:118)
  | 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
  | 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
  | 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
  | 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
  | 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
  | 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
  | 
  | 

how can i delete this ?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071667#4071667

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071667




More information about the jboss-user mailing list