Hibernate (annotation): Error: TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing
March 27th, 2009 by jeremychoneIf you get an error like this one
Hibernate: Error: TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing..
It is probably because you did not annotate your ManyToOne with the Hibernate SAVE_UPATE Cascade annotation:
@ManyToOne()
@Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE})
public Category getCategory() {
return category;
}
Note, putting only
@ManyToOne(cascade = {CascadeType.MERGE,CascadeType.PERSIST})
public Category getCategory() {
…
public Category getCategory() {
…
Will not resolve the issue.
August 4th, 2010 at 11:45 pm
i resolve some aspect with put null the relationship object, then no execute cascade operation.
It can help you or not