[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5614) Reprise of ANN-509: self join class, mapping exception depending on column order

Chris Wilson (JIRA) noreply at atlassian.com
Fri Oct 1 10:01:57 EDT 2010


Reprise of ANN-509: self join class, mapping exception depending on column order
--------------------------------------------------------------------------------

                 Key: HHH-5614
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5614
             Project: Hibernate Core
          Issue Type: Bug
          Components: annotations
    Affects Versions: 3.5.6
         Environment: M2_REPO/javax/activation/activation/1.1/activation-1.1.jar

M2_REPO/javax/el/el-api/2.2/el-api-2.2.jar

M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar

M2_REPO/javax/servlet/jsp/jsp-api/2.1.2/jsp-api-2.1.2.jar

M2_REPO/javax/transaction/jta/1.1/jta-1.1.jar

M2_REPO/javax/xml/soap/saaj-api/1.3/saaj-api-1.3.jar

M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar

M2_REPO/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar

M2_REPO/javax/validation/validation-api/1.0.0.GA/validation-api-1.0.0.GA.jar

M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6.jar

M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0.jar

M2_REPO/org/apache/james/apache-mime4j/0.6/apache-mime4j-0.6.jar

M2_REPO/asm/asm/2.2.3/asm-2.2.3.jar

M2_REPO/org/aspectj/aspectjrt/1.6.2/aspectjrt-1.6.2.jar

M2_REPO/bouncycastle/bcmail-jdk14/138/bcmail-jdk14-138.jar

M2_REPO/org/bouncycastle/bcmail-jdk14/1.38/bcmail-jdk14-1.38.jar

M2_REPO/bouncycastle/bcprov-jdk14/138/bcprov-jdk14-138.jar

M2_REPO/org/bouncycastle/bcprov-jdk14/1.38/bcprov-jdk14-1.38.jar

M2_REPO/org/bouncycastle/bctsp-jdk14/1.38/bctsp-jdk14-1.38.jar

M2_REPO/org/beanshell/bsh/2.0b4/bsh-2.0b4.jar

M2_REPO/c3p0/c3p0/0.9.1/c3p0-0.9.1.jar

M2_REPO/commons-beanutils/commons-beanutils/1.8.2/commons-beanutils-1.8.2.jar

M2_REPO/commons-codec/commons-codec/1.3/commons-codec-1.3.jar

M2_REPO/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar

M2_REPO/commons-digester/commons-digester/1.7/commons-digester-1.7.jar

M2_REPO/commons-io/commons-io/1.4/commons-io-1.4.jar

M2_REPO/commons-lang/commons-lang/2.4/commons-lang-2.4.jar

M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar

M2_REPO/net/sourceforge/cssparser/cssparser/0.9.5/cssparser-0.9.5.jar

M2_REPO/org/apache/cxf/cxf-api/2.2.7/cxf-api-2.2.7.jar

M2_REPO/org/apache/cxf/cxf-common-schemas/2.2.7/cxf-common-schemas-2.2.7.jar

M2_REPO/org/apache/cxf/cxf-common-utilities/2.2.7/cxf-common-utilities-2.2.7.jar

M2_REPO/org/apache/cxf/cxf-rt-bindings-soap/2.2.7/cxf-rt-bindings-soap-2.2.7.jar

M2_REPO/org/apache/cxf/cxf-rt-bindings-xml/2.2.7/cxf-rt-bindings-xml-2.2.7.jar

M2_REPO/org/apache/cxf/cxf-rt-core/2.2.7/cxf-rt-core-2.2.7.jar

M2_REPO/org/apache/cxf/cxf-rt-databinding-aegis/2.2.7/cxf-rt-databinding-aegis-2.2.7.jar

M2_REPO/org/apache/cxf/cxf-rt-databinding-jaxb/2.2.7/cxf-rt-databinding-jaxb-2.2.7.jar

M2_REPO/org/apache/cxf/cxf-rt-frontend-jaxws/2.2.7/cxf-rt-frontend-jaxws-2.2.7.jar

M2_REPO/org/apache/cxf/cxf-rt-frontend-simple/2.2.7/cxf-rt-frontend-simple-2.2.7.jar

M2_REPO/org/apache/cxf/cxf-rt-javascript/2.2.7/cxf-rt-javascript-2.2.7.jar

M2_REPO/org/apache/cxf/cxf-rt-transports-http/2.2.7/cxf-rt-transports-http-2.2.7.jar

M2_REPO/org/apache/cxf/cxf-rt-transports-http-jetty/2.2.7/cxf-rt-transports-http-jetty-2.2.7.jar

M2_REPO/org/apache/cxf/cxf-rt-transports-local/2.2.7/cxf-rt-transports-local-2.2.7.jar

M2_REPO/org/apache/cxf/cxf-rt-ws-addr/2.2.7/cxf-rt-ws-addr-2.2.7.jar

M2_REPO/org/apache/cxf/cxf-tools-common/2.2.7/cxf-tools-common-2.2.7.jar

M2_REPO/org/apache/cxf/cxf-tools-java2ws/2.2.7/cxf-tools-java2ws-2.2.7.jar

M2_REPO/org/apache/cxf/cxf-tools-validator/2.2.7/cxf-tools-validator-2.2.7.jar

M2_REPO/org/apache/cxf/cxf-tools-wsdlto-core/2.2.7/cxf-tools-wsdlto-core-2.2.7.jar

M2_REPO/org/apache/cxf/cxf-tools-wsdlto-databinding-jaxb/2.2.7/cxf-tools-wsdlto-databinding-jaxb-2.2.7.jar

M2_REPO/org/apache/cxf/cxf-tools-wsdlto-frontend-jaxws/2.2.7/cxf-tools-wsdlto-frontend-jaxws-2.2.7.jar

M2_REPO/org/apache/derby/derby/10.6.1.0/derby-10.6.1.0.jar

M2_REPO/org/apache/derby/derbytools/10.6.1.0/derbytools-10.6.1.0.jar

M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar

M2_REPO/org/glassfish/web/el-impl/2.2/el-impl-2.2.jar

M2_REPO/org/springframework/security/facelets-taglib/0.2_jsf-2.0_spring-2/facelets-taglib-0.2_jsf-2.0_spring-2.jar

M2_REPO/freemarker/freemarker/2.3.8/freemarker-2.3.8.jar

M2_REPO/org/apache/geronimo/specs/geronimo-annotation_1.0_spec/1.1.1/geronimo-annotation_1.0_spec-1.1.1.jar

M2_REPO/org/apache/geronimo/javamail/geronimo-javamail_1.4_mail/1.7/geronimo-javamail_1.4_mail-1.7.jar

M2_REPO/org/apache/geronimo/specs/geronimo-jaxws_2.1_spec/1.0/geronimo-jaxws_2.1_spec-1.0.jar

M2_REPO/org/apache/geronimo/specs/geronimo-ws-metadata_2.0_spec/1.1.2/geronimo-ws-metadata_2.0_spec-1.1.2.jar

M2_REPO/org/codehaus/groovy/groovy-all/1.7.5/groovy-all-1.7.5.jar

M2_REPO/org/hibernate/hibernate-annotations/3.5.6-Final/hibernate-annotations-3.5.6-Final.jar

M2_REPO/org/hibernate/hibernate-c3p0/3.5.6-Final/hibernate-c3p0-3.5.6-Final.jar

M2_REPO/org/hibernate/hibernate-commons-annotations/3.2.0.Final/hibernate-commons-annotations-3.2.0.Final.jar

M2_REPO/org/hibernate/hibernate-core/3.5.6-Final/hibernate-core-3.5.6-Final.jar

M2_REPO/org/hibernate/hibernate-entitymanager/3.5.3-Final/hibernate-entitymanager-3.5.3-Final.jar

M2_REPO/org/hibernate/hibernate-envers/3.5.3-Final/hibernate-envers-3.5.3-Final.jar

M2_REPO/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.0.Final/hibernate-jpa-2.0-api-1.0.0.Final.jar

M2_REPO/org/hibernate/hibernate-tools/3.2.0.ga/hibernate-tools-3.2.0.ga.jar

M2_REPO/org/hibernate/hibernate-validator/4.1.0.Beta1/hibernate-validator-4.1.0.Beta1.jar

M2_REPO/net/sourceforge/htmlunit/htmlunit/2.8/htmlunit-2.8.jar

M2_REPO/net/sourceforge/htmlunit/htmlunit-core-js/2.8/htmlunit-core-js-2.8.jar

M2_REPO/org/apache/httpcomponents/httpclient/4.0.1/httpclient-4.0.1.jar

M2_REPO/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1.jar

M2_REPO/org/apache/httpcomponents/httpmime/4.0.1/httpmime-4.0.1.jar

M2_REPO/com/lowagie/itext/2.1.7/itext-2.1.7.jar

M2_REPO/net/sf/jasperreports/jasperreports/3.7.2/jasperreports-3.7.2.jar

M2_REPO/javassist/javassist/3.8.0.GA/javassist-3.8.0.GA.jar

M2_REPO/com/sun/xml/bind/jaxb-impl/2.1.12/jaxb-impl-2.1.12.jar

M2_REPO/com/sun/xml/bind/jaxb-xjc/2.1.12/jaxb-xjc-2.1.12.jar

M2_REPO/jfree/jcommon/1.0.15/jcommon-1.0.15.jar

M2_REPO/eclipse/jdtcore/3.1.0/jdtcore-3.1.0.jar

M2_REPO/org/mortbay/jetty/jetty/6.1.21/jetty-6.1.21.jar

M2_REPO/org/eclipse/jetty/jetty-http/7.0.1.v20091125/jetty-http-7.0.1.v20091125.jar

M2_REPO/org/eclipse/jetty/jetty-io/7.0.1.v20091125/jetty-io-7.0.1.v20091125.jar

M2_REPO/org/eclipse/jetty/jetty-util/7.0.1.v20091125/jetty-util-7.0.1.v20091125.jar

M2_REPO/org/mortbay/jetty/jetty-util/6.1.21/jetty-util-6.1.21.jar

M2_REPO/jfree/jfreechart/1.0.12/jfreechart-1.0.12.jar

M2_REPO/com/sun/faces/jsf-api/2.0.2/jsf-api-2.0.2.jar

M2_REPO/com/sun/faces/jsf-impl/2.0.2/jsf-impl-2.0.2.jar

M2_REPO/jstl/jstl/1.2/jstl-1.2.jar

M2_REPO/org/hibernate/jtidy/r8-20060801/jtidy-r8-20060801.jar

M2_REPO/junit/junit/3.8.2/junit-3.8.2.jar

M2_REPO/log4j/log4j/1.2.13/log4j-1.2.13.jar

/rita/lib/migrate/migrate4j-svn-091117.jar

M2_REPO/mysql/mysql-connector-java/5.1.13/mysql-connector-java-5.1.13.jar

M2_REPO/org/apache/neethi/neethi/2.0.4/neethi-2.0.4.jar

M2_REPO/net/sourceforge/nekohtml/nekohtml/1.9.14/nekohtml-1.9.14.jar

M2_REPO/oro/oro/2.0.8/oro-2.0.8.jar

M2_REPO/org/apache/poi/poi/3.6/poi-3.6.jar

M2_REPO/com/sun/xml/messaging/saaj/saaj-impl/1.3.2/saaj-impl-1.3.2.jar

M2_REPO/org/w3c/css/sac/1.3/sac-1.3.jar

M2_REPO/xalan/serializer/2.7.1/serializer-2.7.1.jar

M2_REPO/org/slf4j/slf4j-api/1.5.8/slf4j-api-1.5.8.jar

M2_REPO/org/slf4j/slf4j-log4j12/1.5.8/slf4j-log4j12-1.5.8.jar

M2_REPO/org/springframework/spring-aop/2.0.8/spring-aop-2.0.8.jar

M2_REPO/org/springframework/spring-beans/2.0.8/spring-beans-2.0.8.jar

M2_REPO/org/springframework/spring-context/2.0.8/spring-context-2.0.8.jar

M2_REPO/org/springframework/spring-core/2.0.8/spring-core-2.0.8.jar

M2_REPO/org/springframework/security/spring-security-core/2.0.4/spring-security-core-2.0.4.jar

M2_REPO/org/springframework/spring-support/2.0.8/spring-support-2.0.8.jar

M2_REPO/org/springframework/spring-web/2.0.8/spring-web-2.0.8.jar

M2_REPO/org/apache/velocity/velocity/1.6.2/velocity-1.6.2.jar

M2_REPO/wsdl4j/wsdl4j/1.6.2/wsdl4j-1.6.2.jar

M2_REPO/org/codehaus/woodstox/wstx-asl/3.2.9/wstx-asl-3.2.9.jar

M2_REPO/xalan/xalan/2.7.1/xalan-2.7.1.jar

M2_REPO/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar

M2_REPO/xml-apis/xml-apis/1.3.02/xml-apis-1.3.02.jar

M2_REPO/xml-resolver/xml-resolver/1.2/xml-resolver-1.2.jar

M2_REPO/org/apache/ws/commons/schema/XmlSchema/1.4.5/XmlSchema-1.4.5.jar

/rita/lib/zxing/zxing13_core.jar

/rita/lib/zxing/zxing13_javase.jar
            Reporter: Chris Wilson
         Attachments: HibernateJoinSameTableMappingTest.java

The attached test case includes two very similar classes, both of which join to themselves, and to one other class (Shipment) with @ManyToOne.

The configuration succeeds for one, but fails for the other with a MappingException:

org.hibernate.MappingException: Unable to find column with logical name shipment_id in table HibernateJoinSameTableMappingTest$SelfJoinFails
	at org.hibernate.cfg.Configuration$MappingsImpl.getPhysicalColumnName(Configuration.java:2733)
	at org.hibernate.cfg.BinderHelper.findPropertiesByColumns(BinderHelper.java:257)
	at org.hibernate.cfg.BinderHelper.createSyntheticPropertyReference(BinderHelper.java:144)
	at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:110)
	at org.hibernate.cfg.AnnotationConfiguration.processEndOfQueue(AnnotationConfiguration.java:541)
	at org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder(AnnotationConfiguration.java:523)
	at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:380)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1377)
	at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954)
	at org.wfp.rita.test.hibernate.HibernateJoinSameTableMappingTest.testFailing(HibernateJoinSameTableMappingTest.java:73)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at junit.framework.TestCase.runTest(TestCase.java:164)
	at junit.framework.TestCase.runBare(TestCase.java:130)
	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.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

The only difference between the two classes is the order of the columns in the self join.

I'm suspecting that the order that the annotations are processed in affects whether this works or not. Perhaps because it's a self join, and the necessary columns have not been created when they are used to join the table to itself?

-- 
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