[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5359) Derived entity usecase fails when the association is bidirectional

Hardy Ferentschik (JIRA) noreply at atlassian.com
Thu Jul 8 04:24:17 EDT 2010


Derived entity usecase fails when the association is bidirectional
------------------------------------------------------------------

                 Key: HHH-5359
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5359
             Project: Hibernate Core
          Issue Type: Bug
          Components: entity-manager
    Affects Versions: 3.5.3
            Reporter: Hardy Ferentschik
             Fix For: 3.6


See https://forum.hibernate.org/viewtopic.php?f=9&t=1005649

The exception is 
{noformat}
org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: org.hibernate.test.annotations.derivedidentities.bidirectional.Dependent.emp in org.hibernate.test.annotations.derivedidentities.bidirectional.Employee.dependents
	at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:655)
	at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:619)
	at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:66)
	at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1221)
	at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:383)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1377)
	at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954)
	at org.hibernate.test.annotations.TestCase.buildConfiguration(TestCase.java:114)
	at org.hibernate.test.annotations.HibernateTestCase.setUp(HibernateTestCase.java:133)
	at org.hibernate.test.annotations.HibernateTestCase.runBare(HibernateTestCase.java:80)
	at com.intellij.junit3.JUnit3IdeaTestRunner.doRun(JUnit3IdeaTestRunner.java:108)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:64)

{noformat}

The mapping is as follows:
{code}
@Entity
public class Employee {
	@Id
	long empId;
	String empName;

	@OneToMany(mappedBy = "emp", fetch = FetchType.LAZY)
	private Set<Dependent> dependents;
}
{code}

{code}
@Entity
//@IdClass(DependentId.class)
public class Dependent implements Serializable {
	@Id
	@ManyToOne
	Employee emp;

	String name;
}
{code}

It does not work with @IdClass either.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list