transient object exception in hibernate

when i  try to persist an object which has child objects.

persist transient child object are  having  configuration parameter value “unsaved-value=0."

i am getting the following error:

transient object exception

Can any one explain the root cause for this error.


With a many-to-one relationship, it would not be appropriate for Hibernate to cascade persistence operations, since the "one" is conceptually an entity shared between many others. This kind of relationship isn't a "child object", as you put it.

You can override this behaviour by explicitly setting the cascade attribute on the relation, or you can manually persist the other end of the many-to-one relations.

I would recommend reading this entire chapter from the Hibernate docs to understand fully the terminology of transient, persistent and detached:

Answer is