[hibernate-issues] [JIRA] (HHH-13915) Shared interceptor in BasicProxyFactoryImpl leads to intermittently broken persistence

Henry Clout (JIRA) jira at hibernate.atlassian.net
Mon Mar 30 18:35:15 EDT 2020


Henry Clout ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5bd6e4bbdd3cc64b77e71f5f ) *created* an issue

Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiN2MxYWJkZThiNzJmNDlhOTk0YjYxMjMyZGJmZjMwNDciLCJwIjoiaiJ9 ) / Bug ( https://hibernate.atlassian.net/browse/HHH-13915?atlOrigin=eyJpIjoiN2MxYWJkZThiNzJmNDlhOTk0YjYxMjMyZGJmZjMwNDciLCJwIjoiaiJ9 ) HHH-13915 ( https://hibernate.atlassian.net/browse/HHH-13915?atlOrigin=eyJpIjoiN2MxYWJkZThiNzJmNDlhOTk0YjYxMjMyZGJmZjMwNDciLCJwIjoiaiJ9 ) Shared interceptor in BasicProxyFactoryImpl leads to intermittently broken persistence ( https://hibernate.atlassian.net/browse/HHH-13915?atlOrigin=eyJpIjoiN2MxYWJkZThiNzJmNDlhOTk0YjYxMjMyZGJmZjMwNDciLCJwIjoiaiJ9 )

Issue Type: Bug Affects Versions: 5.4.12 Assignee: Unassigned Components: hibernate-core Created: 30/Mar/2020 15:35 PM Environment: Hibernate 5.4.12, OpenJDK11, CentOS7, MySQL/CloudSQL Priority: Major Reporter: Henry Clout ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5bd6e4bbdd3cc64b77e71f5f )

When persisting a parent, child relationship - cascaded from parent to child - with the child having a composite unique key configured as:

<?xml version= "1.0" encoding= "UTF-8" ?>
<!DOCTYPE hibernate-mapping PUBLIC "- //Hibernate/Hibernate Mapping DTD 3.0//EN"
		"http: //www.hibernate.org/dtd/hibernate-mapping-3.0.dtd" >
<hibernate-mapping package = "com.qumu" >
	< class name= "MetadataValue" table= "metadata_value" >
		<id column= "id" name= "id" type= " long " >
			<generator class= " native " >
				<param name= "sequence" >hibernate_sequence</param>
			</generator>
		</id>
		<properties name= "unique-props" unique= " true " >
			<property column= "guid" name= "guid" not- null = " true " type= "string" />
			<many-to-one class= "com.qumu.Customer" column= "customer_id" name= "customer" not- null = " true " />
		</properties>
	</ class& gt;
</hibernate-mapping>

A BasicProxyFactoryImpl is used by Hibernate to proxy the composite unique key values. However, this factory generates proxies which share a ProxyConfiguration.Interceptor. As the interceptor holds the bean state during persistence, this leads to persistence failure under concurrent use.

In our particular use case, this manifested as unique constraint failures as the guid property above was reused by threads sharing the interceptor.

Proposed solution is to instantiate a new interceptor per innovation of BasicProxyFactoryImpl. getProxy()

( https://hibernate.atlassian.net/browse/HHH-13915#add-comment?atlOrigin=eyJpIjoiN2MxYWJkZThiNzJmNDlhOTk0YjYxMjMyZGJmZjMwNDciLCJwIjoiaiJ9 ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-13915#add-comment?atlOrigin=eyJpIjoiN2MxYWJkZThiNzJmNDlhOTk0YjYxMjMyZGJmZjMwNDciLCJwIjoiaiJ9 )

Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100122- sha1:8399ad5 )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200330/233c4318/attachment.html 


More information about the hibernate-issues mailing list