Done issues

DefaultMergeEventListener.unproxyManagedForDetachedMerging fails if parameter managed is a HibernateProxy
HHH-13624
TransientObjectException merging a non-proxy association to a HibernateProxy
HHH-13590
Upgrade to Agroal 1.6
HHH-13686
Bugs join-fetching a collection when scrolling with a stateless session using enhancement as proxy
HHH-13633
AssertionFailure: Exception releasing cache locks upon After/BeforeTransactionCompletionProcess failure
HHH-13666
Selecting an entity annotated with @Immutable but not with @Cachable causes a NPE when use_reference_entries is enabled
HHH-13665
MapBinder.createFormulatedValue() does not honor DB schema name when creating query
HHH-4235
Have EntityManagerFactory expose persistence.xml `jta-data-source` element as a `javax.persistence.nonJtaDataSource` property
HHH-13432
PersistenceContext can get cleared before load completes using StatelessSessionImpl
HHH-13634
Cryptic error when providing import.sql file without a terminal char at the end of each line
HHH-13673
The temporary PersistenceContext of a StatelessSession is not cleared after a refresh operation
HHH-13672
integration overrides during JPA bootstrap ought to override all logically related settings
HHH-12858
Reduce allocation costs of IdentityMaps used by ResultSetProcessingContextImpl
HHH-13660
Upgrade to Byteman 4.0.8
HHH-13681
Optimize PersistentBag.groupByEqualityHash()
HHH-13675
Upgrade to Byte Buddy 1.10.2
HHH-13680
Uninitialized HibernateProxy mapped as NO_PROXY gets initialized when reloaded with enhancement-as-proxy enabled
HHH-13640
Uninitialized entity does not get initialized when a setter is called with enhancement-as-proxy enabled
HHH-13653
Avoid initializing XmlMappingBinderAccess when no XML mappings are defined
HHH-13662
_MOD columns not named correctly when using custom column names
HHH-10398
Envers Map<Enum, Integer> causes NullPointerException when mapped with @MapKeyEnumerated since Hibernate 5.4.6
HHH-13655
Session#setHibernateFlushMode() method not callable without an active transaction
HHH-13663
Omit joining of superclass table when querying subclass only
HHH-12993
Missing table in SQL from clause that is referenced in where clause when using joined subclass
HHH-1631
Fields annotated with @Column(updatable=false) are not inserted properly after persist() is called
HHH-13637
HQL query against field marked with @Lob fails on PostgreSQL
HHH-11477
Improve performance of PersistentBag.equalsSnapshot
HHH-11032
Format conversion error in org.hibernate.cfg.Settings
HHH-13649
Provide Gradle-based bytecode enhancement as a task separate from the compileJava task
HHH-13130
Hibernate startup error "HHH015011: Unable to locate static metamodel field"
HHH-8712
Persistence.createEntityManagerFactory(Map) should allow dynamic specification of jta datasource
HHH-13646
ClassCastException when using a single region name for both entity and query results
HHH-13586
SessionImpl#loadEvent#shouldUnwrapProxy is not set back to null after SessionImpl#internalLoad loads entity
HHH-13610
StatsNamedContainer#getOrCompute throws NullPointerException when computed value is null
HHH-13645
maven-metadata.xml are not updating for envers and c3p0 on maven central
HHH-13473
Envers cannot support @IdClass referencing foreign entity identifier
HHH-10667
Audit table schema generation creates foreign key constraint to Entity table for EmbeddedId containing ManyToOne
HHH-11107
Envers Map<Enum, Entity> not auditing correctly
HHH-11797
After upgrading to 5.4.5, it's no longer possible to bootstrap Hibernate if the org.hibernate.cfg LOG is set to DEBUG
HHH-13625
For a native query, the SessionImpl class does not call applyQuerySettingsAndHints
HHH-13493
Building DatabaseInformation fails on H2 without DATABASE_TO_UPPER
HHH-13597
Accessing id property of association within element collection in query leads to exception
HHH-13045
Invalid {h-schema} replacement in native sql queries
HHH-5692
Minor cleanup of build scripts
HHH-13428
Enable the hibernate-orm-modules test for JDK 11
HHH-13616
Disable OSGi testing for JDK 11+
HHH-13421
Support building javadoc with JDK 11.0.3
HHH-13419
Improve build compatibility with JDK11.0.3
HHH-13415
Re-introduce usage of net.bytebuddy.experimental=true when testing on JDK > 11
HHH-13275
Javadoc build failures on JDK 12
HHH-13271
issue 1 of 10662

DefaultMergeEventListener.unproxyManagedForDetachedMerging fails if parameter managed is a HibernateProxy

Description

The method DefaultMergeEventListener.unproxyManagedForDetachedMerging contains a bug in case the parameter managed is a HibernateProxy. It results in a StaleObjectStateException because DefaultMergeEventListener.isVersionChanged() always return true.

The code in DefaultMergeEventListener.unproxyManagedForDetachedMerging
if ( incoming instanceof HibernateProxy ) {
return source.getPersistenceContextInternal().unproxy( managed );
}

should be replaced by
if ( managed instanceof HibernateProxy ) {
return source.getPersistenceContextInternal().unproxy( managed );
}

to make it working again.

Environment

Hibernate ORM 5.4.4, JVM 11.0.2, Windows 10, Oracle 12

Status

Assignee

Gail Badner

Reporter

Reto Urfer

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Worked in

5.4.0

Components

Affects versions

5.4.4

Priority

Blocker
Configure