| Bolek Ziobrowski, thanks for the test case. This is definitely a bug. Hibernate should not be trying to initialize a property on a detached entity. In 4.2, when the merge operation cascades to the lazy association here, the value extracted from the entity by persister.getPropertyValue( parent, i ) is null, not an initialized value. As a result, cascadeProperty() does nothing. I believe that is the correct behavior for a bytecode-enhanced lazy *-to-one association. If the association being merged was an uninitialized proxy instead, Hibernate would merge that proxy by simply loading an uninitialized proxy without initializing it and adding it to the `PersistenceContext`. The corresponding code in master is here. You can see that Hibernate explicitly loads the lazy association in the detached entity, which is incorrect. |