2

I am struck with a problem while using hibernate. The situation is :

I am creating a container and in that container i am adding 2 components. one component
is a newly created component and the other one is already existing in the database.i am getting an exception when i try to save the container. i get transient object exception. I tried giving cascade options as refresh but that doesnt work.

Thanks and Regards, Rima Desai

1 Answer 1

2

Transient object exception happen when a non-transient object (which is managed by the hibernate session) references an object that is not managed by the session. In your case I believe the container is referencing the new object. did you call session.Save(newObject);? Alternatively you can mark the relationship between the container as "cascade=save" to that saving it will cause the session to save its related objects.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.