Vojtech Juranek created ISPN-4072:
-------------------------------------
Summary: JPA Cache Store fails to clear entity which conatins
ElementCollection
Key: ISPN-4072
URL:
https://issues.jboss.org/browse/ISPN-4072
Project: Infinispan
Issue Type: Bug
Components: Loaders and Stores
Reporter: Vojtech Juranek
Assignee: Dan Berindei
When entity stored by JPA Cache Store contains
[
ElementCollection|http://docs.oracle.com/javaee/6/api/javax/persistence/E...],
{{clear()}} operation fails with foreign key constraint violation.
Stack trace in case of MySQL:
{noformat}
org.infinispan.persistence.jpa.JpaStoreException: Exception caught in clear()
at org.infinispan.persistence.jpa.JpaStore.clear(JpaStore.java:143)
at
org.infinispan.persistence.jpa.BaseJpaStoreTest.setUp(BaseJpaStoreTest.java:85)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: javax.persistence.PersistenceException:
org.hibernate.exception.ConstraintViolationException: could not execute statement
at
org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387)
at
org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310)
at
org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:1397)
at org.hibernate.ejb.AbstractQueryImpl.executeUpdate(AbstractQueryImpl.java:108)
at org.infinispan.persistence.jpa.JpaStore.clear(JpaStore.java:128)
... 23 more
Caused by: org.hibernate.exception.ConstraintViolationException: could not execute
statement
at
org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:74)
at
org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)
at
org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
at
org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)
at
org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:136)
at
org.hibernate.hql.internal.ast.exec.BasicExecutor.execute(BasicExecutor.java:103)
at
org.hibernate.hql.internal.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:413)
at
org.hibernate.engine.query.spi.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:282)
at org.hibernate.internal.SessionImpl.executeUpdate(SessionImpl.java:1290)
at org.hibernate.internal.QueryImpl.executeUpdate(QueryImpl.java:116)
at org.hibernate.ejb.QueryImpl.internalExecuteUpdate(QueryImpl.java:194)
at org.hibernate.ejb.AbstractQueryImpl.executeUpdate(AbstractQueryImpl.java:99)
... 24 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:
Cannot delete or update a parent row: a foreign key constraint fails
(`ispn_jpa_test`.`Person_nickNames`, CONSTRAINT `FK_ne1r4l90nve6426b7c7ws198i` FOREIGN KEY
(`Person_id`) REFERENCES `Person` (`id`))
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.Util.getInstance(Util.java:386)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1039)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4098)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4030)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2677)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2134)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2434)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2352)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2337)
at
org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:133)
... 31 more
{noformat}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira