Problem:
TransientObjectException is hibernate (nhibernate in my little world) exception which occurs when you flush.
Identify the code which causes it:
It is simple. Put nhibernate session.IsDirty() underwatch. Execute your program stpe by step. You are 'ok' till IsDirty give you 'true' or 'false'. You can identify the culprit step when IsDirty raises any exception.
No one can you tell you exact solution as this may be caused by variety of mistakes. The root cause is that you are trying to save an object into database which has transient objects (not existing in database in our context) attached to it. Solution is to save the transient objects before flush or just remove the "cascade" attribute from the HBM.
2 comments:
how do you get ride of a transient object though? if you don't want to save it?
Simply detach from the parent entity i.e. nullify parent entity's variable with which your transient object is attached.
Make sure you do not run 'flush' unless the transient object is detached.
Post a Comment