[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6958) PrePersist is called on object although no merge/persist operation is cascaded/applied
Benjamin Diedrichsen (JIRA)
noreply at atlassian.com
Wed Jan 11 08:21:09 EST 2012
PrePersist is called on object although no merge/persist operation is cascaded/applied
--------------------------------------------------------------------------------------
Key: HHH-6958
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6958
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 4.0.0.Final, 4.0.0.CR2
Environment: JBoss AS 7
Reporter: Benjamin Diedrichsen
Priority: Critical
The scenario: A persistent instance of class A is loaded. A transient object of type b is created and with it a transient object of type c. Then the merge operation is invoked on A.
The unexpected behaviour now is that the @PrePersist method on C is called although the causing merge-operation does not apply (not cascaded from B to C) and is actually not executed on the object (--> C will not be persisted to the database).
Why is PrePersist invoked for C if no persist or merge operation is actually cascaded?
Class A{
@OneToOne(cascade = CascadeType.ALL, optional = true, orphanRemoval = true)
private B b;
}
Class B{
@ManyToOne(optional = false, cascade={CascadeType.PERSIST})
private C c;
}
Class C{
// some basic attributes here
}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list