|
I'd say this is as the JPA spec mandates it. See the JPA spec 3.5.3 for reference.
For entities to which the merge operation has been applied and causes the creation of newly managed instances, the PrePersist callback methods will be invoked for the managed instance after the entity state has been copied to it.
The transient parts of an entity are definitvely not part of the entity state. So this is actually more a feature request than a bug. @Steve Ebersole what do you think about this?
Apart from that a side note. JPA spec 3.5.2 says it's non portable to change the entity state in lifecycle methods. You have been warned 
In general, the lifecycle method of a portable application should not invoke EntityManager or query operations, access other entity instances, or modify relationships within the same persistence context[46].[47] A lifecycle callback method may modify the non-relationship state of the entity on which it is invoked.
|