This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate - org.hibernate.AssertionFailure: no queued adds  RSS feed

Abhishek Gayakwad
Posts: 4
Hibernate IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
org.hibernate.AssertionFailure: no queued adds
Getting above exception while flush

Use case – In our application, before doing any logical operation we persist whole state of statefull EJB including session to file or in memory byte [], and we restore this state if we encounter any exception. In this particular case I have performed following steps.

1. Fetch an object which has a list (size>0, lazy = true) in it.
2. Add another object in this list.
3. Serialize session.
4. Restore session.
5. Try to call flush on session, and we get the following exception.

Exception in thread "main" org.hibernate.AssertionFailure: no queued adds
at org.hibernate.action.CollectionUpdateAction.execute(
at org.hibernate.engine.ActionQueue.execute(
at org.hibernate.engine.ActionQueue.executeActions(
at org.hibernate.engine.ActionQueue.executeActions(
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions
at org.hibernate.event.def.DefaultFlushEventListener.onFlush
at org.hibernate.impl.SessionImpl.flush(
at Main.main(

This problem comes because of usage of bag and transient variable (transient List operationQueue) in AbstractPersistentCollection class of hibernate. Bag doesn’t get initialized when object is added to it; instead this object gets added to operationQueue List which is transient so when we restore it back previous value is lost.

Solution –
1. Eagerly load collection (lazy = false)
2. Use set instead of bag

Please suggest me any other solution for solving this problem. Why operationQueue object is transient?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!