BytecodeEnhancement's AssociationManagement breaks with entity containing two relations with the same mappedBy value

Description

The bug is identical to HHH-10583, but affects all relations.

Example:

Error message:

If I rename the property in the other side of the relationship and update the mappeBy value, the error goes away.

I also tried it against those SNAPSHOT versions:
hibernate-core-5.0.10-20160623.151413-54
hibernate-core-5.1.1-20160623.143543-104
hibernate-core-5.2.1-20160623.160329-60

Environment

None

Activity

Show:
Humberto Ferreira da Luz Junior
July 1, 2016, 11:36 PM

You're right @Ashok, I was trying a few combinations to reproduce the error and I sent the wrong code.

I uploaded two new test cases.

In the unsuccessful one, I did this mapping:

I changed the mapping of the successful one to:

Renaming the variable team to team1 was enough to avoid this error. It only happens when there're a OneToOne and a OneToMany relationship mapping to the same name.

Luis Barreiro
July 6, 2016, 12:03 AM

there is an error on your pom.xml. The version of the maven plugin should be the same as for other hibernate artifacts. In particular, when I use a version where is fix (currently only 5.2.1 is released, but there are snapshots available on 5.0 and 5.1 branches) your UnsuccessfulTestCase passes.

Humberto Ferreira da Luz Junior
July 6, 2016, 12:51 AM

That's weird @Luis Barreiro, I had tried the 3 snapshots versions before (like I said in this issue report) and it didn't work.

I redownloaded the unsuccessful test case I have uploaded, I changed the hibernate version to both 5.1.1-SNAPSHOT and 5.2.1-SNAPSHOT, and the error still happens.

All I did was add the jboss snapshot repository:

And change version.org.hibernate:

Am I missing something?

I'm uploading the unsuccessful test case again with the SNAPSHOT version set.

Luis Barreiro
July 6, 2016, 3:31 PM

you are missing one thing, it's the version of the hibernate-maven-plugin. In your latest sample it's still set to 5.0.7.Final.

Please note that you'll need to enable the snapshots for plugins as well:

Humberto Ferreira da Luz Junior
July 8, 2016, 12:36 AM

Now that you mention it, it makes total sense. I don't know why I forgot to update the plugin version.

I tried again and it worked. Thanks and sorry for the trouble..

Assignee

Unassigned

Reporter

Humberto Ferreira da Luz Junior

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure