Hibernate version:
3.0.5
Mapping documents:
Irrelevant
Code between sessionFactory.openSession() and session.close():
load an object
modify it, add new items to a Set
ask for session.refresh() to cancel change
Full stack trace of any exception that occurs:
Code:
Caused by: org.hibernate.HibernateException: this instance does not yet exist as a row in the database
at org.hibernate.event.def.DefaultRefreshEventListener.onRefresh(DefaultRefreshEventListener.java:77)
at org.hibernate.impl.SessionImpl.refresh(SessionImpl.java:679)
at org.hibernate.engine.Cascades$3.cascade(Cascades.java:112)
at org.hibernate.engine.Cascades.cascadeAssociation(Cascades.java:771)
at org.hibernate.engine.Cascades.cascade(Cascades.java:720)
at org.hibernate.engine.Cascades.cascadeCollection(Cascades.java:895)
at org.hibernate.engine.Cascades.cascadeAssociation(Cascades.java:792)
at org.hibernate.engine.Cascades.cascade(Cascades.java:720)
at org.hibernate.engine.Cascades.cascade(Cascades.java:847)
at org.hibernate.engine.Cascades.cascade(Cascades.java:819)
at org.hibernate.event.def.DefaultRefreshEventListener.onRefresh(DefaultRefreshEventListener.java:85)
at org.hibernate.impl.SessionImpl.refresh(SessionImpl.java:679)
Name and version of the database you are using:
Oracle 9
The generated SQL (show_sql=true):
none
Hello,
I have a class which contains some sets (one-to-many contraints). The user modify at will the object, add items to set, remove items, etc, but does not flush nor save the object. Because user wants to cancel changes, we issue a session.refresh(manipulatedObject). While we would expect the object to get back to database state (same is if it was not cached in session and we issued a session.load(id) ) it does not refresh() properly.
How can we reset the object to it's database state, including all object linked via Sets?
Thanks for help.