JPA delete hangs in 1.2.1

120 views
Skip to first unread message

MikeB

unread,
May 20, 2011, 5:01:30 PM5/20/11
to play-framework
I just updated my Play installation from 1.1.1 to 1.2.1 and I'm having
a number of JPA-related issues. The most blatant of which is that
calls to the GenericModel.delete() method hang and fail.

I have the following method:

public static void delete(int id) throws Exception {
Node node = Node.findById(id);
if (node == null) { notFound(); return; }
node.delete();
renderJSON(node);
}

which executed without issue in 1.1.1. After the 1.2.1 update, the
call to .delete() hangs. I have verified that the correct Node
instance is returned by the findById() method.

After a time, the following appears on the console:

20/05/11 15:45:58,417 [ERROR] AbstractBatcher;73: Exception executing
batch:
org.hibernate.StaleStateException: Batch update returned unexpected
row count from update [0]; actual row count: 0; expected: 1
at org.hibernate.jdbc.Expectations
$BasicExpectation.checkBatched(Expectations.java:85)
at org.hibernate.jdbc.Expectations
$BasicExpectation.verifyOutcome(Expectations.java:70)
at
org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:
90)
at
org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:
70)
at
org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:
268)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:
268)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:
189)
at
org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:
345)
at
org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:
51)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
at
org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:
795)
at play.db.jpa.JPABase._delete(JPABase.java:73)
at play.db.jpa.GenericModel.delete(GenericModel.java:219)
at controllers.Nodes.delete(Nodes.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:
540)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:498)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:
474)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:
469)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:157)
at play.test.FunctionalTest$1.execute(FunctionalTest.java:265)
at play.Invoker$Invocation.run(Invoker.java:265)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:
441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
20/05/11 15:45:58,420 [ERROR] AbstractFlushingEventListener;348: Could
not synchronize database state with session
org.hibernate.StaleStateException: Batch update returned unexpected
row count from update [0]; actual row count: 0; expected: 1
at org.hibernate.jdbc.Expectations
$BasicExpectation.checkBatched(Expectations.java:85)
at org.hibernate.jdbc.Expectations
$BasicExpectation.verifyOutcome(Expectations.java:70)
at
org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:
90)
at
org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:
70)
at
org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:
268)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:
268)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:
189)
at
org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:
345)
at
org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:
51)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
at
org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:
795)
at play.db.jpa.JPABase._delete(JPABase.java:73)
at play.db.jpa.GenericModel.delete(GenericModel.java:219)
at controllers.Nodes.delete(Nodes.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:
540)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:498)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:
474)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:
469)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:157)
at play.test.FunctionalTest$1.execute(FunctionalTest.java:265)
at play.Invoker$Invocation.run(Invoker.java:265)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:
441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)

Any help?

I have made no changes to the application itself, just updated Play
from 1.1.1 to 1.2.1.

thanks

MikeB

unread,
May 20, 2011, 5:11:10 PM5/20/11
to play-framework
Just some added info:

I down-loaded Play 1.2 and the problem exists there as well.

Reverting back to 1.1.1 eliminates the issue.

MikeB

unread,
May 20, 2011, 5:33:06 PM5/20/11
to play-framework
And, in case it is helpful. my DB config:

%test.db.url=jdbc:postgresql://localhost:5432/fiori_test
%test.db.driver=org.postgresql.Driver
%test.db.user=xxxxxx
%test.db.pass=xxxxxx
%test.jpa.dialect=org.hibernate.dialect.PostgreSQLDialect
%test.jpa.ddl=create-drop
%test.jpa.debugSQL=false

Guillaume Bort

unread,
May 21, 2011, 6:05:51 AM5/21/11
to play-fr...@googlegroups.com
I think that the issue is related to the migration to Hibernate 3.6 in
Play 1.2.x. But you are the only one to report this problem. Have you
searched for a similar problem on the Hibernate groups?

> --
> You received this message because you are subscribed to the Google Groups "play-framework" group.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>
>

--
Guillaume Bort, http://guillaume.bort.fr

Reply all
Reply to author
Forward
0 new messages