user3016044
user3016044

Reputation: 21

org.hibernate.TransientObjectException: object references an unsaved transient instance

Hi all currently I'm using Hibernate 4.1.5 , i tried in different ways. But I'm unable to resolve the issue. Because of this issue my production server becomes hanging.

Any help would be great. Thanks!

ISSUE DESCRIPTION:

Trying to rollback database transaction after exception

org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing:
 omegon.bo.exam.ExamQuestionAttemptBO
        at org.hibernate.engine.internal.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:249)
        at org.hibernate.type.EntityType.getIdentifier(EntityType.java:459)
        at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:276)
:

Upvotes: 2

Views: 9731

Answers (1)

Vinay Veluri
Vinay Veluri

Reputation: 6855

The issue is with saving the dependent objects...

For example, class A contains relation with class B - assume its one to many with the primary key of B.

Save B instance first, so that the relation - foreign key relation(ID) with A will be available before saving A.

Visit this link for an example.

Upvotes: 2

Related Questions