org.hibernate.PropertyValueException: Detached entity with generated id

Solution Verified - Updated -

Issue

  • After updating to EAP 7.4 Update 13, hibernate is throwing error while inserting new record. Same code was working in EAP 7.4 Update 12

table A has B_ID reference column
table B has ID column
a record is inserted to table B
then we insert a record to table A referencing the ID of the new record in table B using column B_ID
then we get a failure on null VERSION on table B

javax.persistence.PersistenceException: org.hibernate.PropertyValueException: Detached entity with generated id '123456' has an uninitialized version value 'null' 

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7.4 Update 13

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content