[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4939) Bidirectional OneToOne mapping with FK and composite PK sharing a column throws MappingException
Chris Wilson (JIRA)
noreply at atlassian.com
Thu Feb 17 09:25:05 EST 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4939?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=40010#action_40010 ]
Chris Wilson commented on HHH-4939:
-----------------------------------
Does that mean that @JoinColumn is ignored on @OneToOne associations? Is this documented anywhere? Is it possible to detect this case and make it fail, or even better, to support it?
> Bidirectional OneToOne mapping with FK and composite PK sharing a column throws MappingException
> ------------------------------------------------------------------------------------------------
>
> Key: HHH-4939
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4939
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.3.2
> Reporter: Chris Wilson
> Attachments: HibernateAnnotationMappingOneToOneTest.java
>
>
> A bidirectional one-to-one mapping, where the owning side's column is part of a composite primary key, fails to configure, possibly because OneToOneType#getColumnSpan returns zero instead of the actual number of columns used by the join.
> When the foreign key column used is not also part of the primary key, or the composite primary key contains only a single column, then the mapping doesn't fail.
> {code}
> org.hibernate.MappingException: broken column mapping for: journeyComment.id of: org.wfp.rita.test.hibernate.HibernateAnnotationMappingOneToOneTest$Journey
> at org.hibernate.persister.entity.AbstractPropertyMapping.initPropertyPaths(AbstractPropertyMapping.java:143)
> at org.hibernate.persister.entity.AbstractPropertyMapping.initIdentifierPropertyPaths(AbstractPropertyMapping.java:206)
> at org.hibernate.persister.entity.AbstractPropertyMapping.initPropertyPaths(AbstractPropertyMapping.java:181)
> at org.hibernate.persister.entity.AbstractEntityPersister.initOrdinaryPropertyPaths(AbstractEntityPersister.java:1725)
> at org.hibernate.persister.entity.AbstractEntityPersister.initPropertyPaths(AbstractEntityPersister.java:1755)
> at org.hibernate.persister.entity.AbstractEntityPersister.postConstruct(AbstractEntityPersister.java:2932)
> at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:431)
> at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:84)
> at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:267)
> at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
> at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
> at org.wfp.rita.test.base.HibernateTestBase.buildSessionFactory(HibernateTestBase.java:93)
> at org.wfp.rita.test.base.HibernateTestBase.setUp(HibernateTestBase.java:106)
> at junit.framework.TestCase.runBare(TestCase.java:128)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:120)
> at junit.framework.TestSuite.runTest(TestSuite.java:230)
> at junit.framework.TestSuite.run(TestSuite.java:225)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> {code}
> Test case attached. Change HibernateTestBase to org.hibernate.test.annotations.TestCase to run under Hibernate.
--
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