Can't model nested Embeddables with a ManyToOne

Description

I want to have an object model with four classes, two entities (A and B) and two embeddeables (X and Y). A has a list of X, which contains a Y, which refers to a B.

If I set up a Configuration with these classes, and use SchemaExport to produce SQL for it, I expect to get tables for A and B, and a collection table that links the two with any information that X and Y have. Instead, the collection table just has A.

I can workaround by collapsing X and Y, so there's no Embeddable nesting, but I feel like this should work. Indeed, I tried it in another JPA implementation (EclipseLink) and it does work.

I've attached the four classes along with a runnable test case that just runs the described SchemaExport.

Environment

Any database, Hibernate4 or 3.

Activity

Show:
Willie Conrad
October 28, 2015, 2:19 AM
Edited

I verified that the example I posted on 08/May/2015 still fails in 5.0.2. Can't seem to edit affected-versions, but 5.0.2 should go on that list.

Steve Ebersole
October 28, 2015, 2:54 AM

Awesome. Thanks for verifying!

Steve Ebersole
October 28, 2015, 3:24 AM

As part of verifying that this issue affects 5.0, please just set the "Affects version". Leave the "verify-affects-5.0" label and leave the issue in "Awaiting Response" status; these are critical for us to be able to track these verifications and triage them. Thanks.

Markus Malkusch
May 14, 2016, 2:23 PM

Let me inform you that this issue is still in 5.1.0 present.

Moody Salem
August 26, 2016, 3:31 PM
Edited

I created a test case in this repository
https://github.com/moodysalem/hibernate-tests/tree/master/src/main/java/model/embeddabletwice

edit: note this repository uses hibernate 5.2.2

Assignee

Unassigned

Reporter

ChrisL

Fix versions

backPortable

None

Suitable for new contributors

None

Requires Release Note

Affirmative

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure