Hibernate complains about an unknown mappedBy property when mapping a bidirectional OneToOne relation with a derived identifier

Description

I have a OneToOne mapping between Foo and Bar where Bar uses a derived identifier. So Bar is the "dependent" entity and has a single primary key attribute which is mapped by the relationship attribute (i.e. using `Id` on the `OneToOne` relationship).

Foo is mapped like this:

and Bar:

This mapping is described in the section 2.4.1.2 of the JPA 2.0 specification, Example 4, case (a) and works with the RI (run mvn test -Peclipselink,h2 on the attached project).

However, Hibernate fails to initialize and complains about the mappedBy attribute:

Run mvn test to reproduce.

Environment

Hibernate 3.5+, any database.

Activity

Show:
Gail Badner
January 17, 2011, 11:49 PM
Edited

Thanks, Emmanuel.

I've added the attached test as a "FailureExpected test that reproduces this issue:
org.hibernate.test.annotations.derivedidentities.bidirectional.OneToOneWithDerivedIdentityTest

The test has been added to hibernate-core master and 3.6.

Ka Wu
October 26, 2012, 8:49 AM

Yawn... Is no one able to fix this, has this been fixed already, or is no one interested in fixing this?

Andrey Semenov
January 18, 2013, 1:36 PM

Just stuck of this bug too. Is any activity on it on?

Andrey Semenov
January 18, 2013, 2:19 PM

Just debugged my app deep into Hibernate's mapper. Not my case. Though, given property somestuff and method getSomeStuff() if I annotate methods as latest guidelines advice I need to write maddedBy="someStuff" not "somestuff" whatever name my entity class property has in case-sensitive point.

Brett Meyer
May 15, 2013, 8:55 PM

Closing this one – corrected by

Assignee

Brett Meyer

Reporter

PascalP

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Priority

Major
Configure