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
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.
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?
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads