This week's book giveaway is in the Java in General forum.
We're giving away four copies of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 and have ishori Sharan & Adam L Davis on-line!
See this thread for details.
Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

Abhishek Gayakwad

Greenhorn
+ Follow
since Aug 25, 2006
Abhishek likes ...
IntelliJ IDE Hibernate Java
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Abhishek Gayakwad

Any idea how apache http client handles Retry-After header ?
Apache has given default retry handler implementation, but I am not able to see any retry header based logic there.
if it does not handles the retry header, whats the proper way to implement it. (date parsing and sleep logic)
What is purpose of using Marker interfaces ??
11 years ago
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(CollectionUpdateAction.java:67)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:268)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:260)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:182)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions
(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush
(DefaultFlushEventListener.java:51)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206)
at Main.main(Main.java:46)


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?
Why we can not start a dead thread again.
what kind of implementaion it has ???