[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-6958) PrePersist is called on object although no merge/persist operation is cascaded/applied
Gail Badner (JIRA)
noreply at atlassian.com
Tue Jan 17 11:24:09 EST 2012
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-6958?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gail Badner updated HHH-6958:
-----------------------------
Attachment: (was: PrePersistBugTest.java)
> 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 ORM
> Issue Type: Bug
> Components: core
> Affects Versions: 4.0.0.CR2, 4.0.0.Final
> Environment: JBoss AS 7
> Reporter: Benjamin Diedrichsen
> Priority: Critical
> Labels: jpa2
> Attachments: PrePersistBugNewTest.java, PrePersistBugTest.java
>
>
> 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