@JoinFormula adds a unique index to the target column which conflicts with the unique
property
----------------------------------------------------------------------------------------------
Key: HHH-5685
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5685
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: HibernateSchemaExportUniqueColumnAndForeignKeyDerbyFailsTest.java
When a @JoinFormula references a column which has a unique attribute on it, @SchemaExport
creates two separate keys that cover the same columns:
* The unique attribute on the end of the column definition;
* A separate unique key after the column and primary key definitions, from being the
target of a ManyToOne association.
Derby doesn't like this and fails with an error like this:
{code}
create table product (id integer not null,
product_idnf char(18) not null unique, primary key (id),
unique (product_idnf)): Constraints 'SQL101020115435462' and
'SQL101020115435460' have the same set of columns, which is not allowed.
{code}
Proposed fix: in Table#getUniqueKeys, when the unique key has a single column, check
whether that column is already unique, and if so don't generate the unique key.
Test case, including test for the patch, attached.
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira