+++ This bug was initially created as a clone of Bug #991578 +++ In H2 the generated schema works: [main ] DEBUG - 18:27:01,763 - org.hibernate.SQL: create table Item ( id bigint not null, name varchar(255), SELLER_CUSTOMERNR varchar(255), primary key (id) ) [main ] DEBUG - 18:27:01,769 - org.hibernate.SQL: create table USERS ( id bigint not null, customerNr varchar(255), primary key (id) ) [main ] DEBUG - 18:27:01,769 - org.hibernate.SQL: alter table Item add constraint FK_76d41162ea614944b8333c7c440 foreign key (SELLER_CUSTOMERNR) references USERS (customerNr) [main ] DEBUG - 18:27:01,775 - org.hibernate.SQL: alter table USERS add constraint UK_8a5ec890d05a4545a1e9660dea0 unique (customerNr) On Oracle this fails, as the foreign key reference is actually checked before the UNIQUE constraint is generated. http://www.techonthenet.com/oracle/errors/ora02270.php
This patch will be based off of 979103
This should be considered as superseding 979103 altogether, in my opinion.
Created attachment 782180 [details] patched Hibernate module
http://git.app.eng.bos.redhat.com/?p=hibernate/hibernate-core.git;a=shortlog;h=refs/heads/BZ-991581_4.2.0.Final
No regressions were found and the issue was verified. QA Passed. md5sum of tested files: 89bab72cce8577e47e57dea2790558e6 BZ991581.zip c8d720de9d682b212e0aed565e9aad84 BZ-991581.zip 6a6cc939a97fd1b2fc9a9676ea8639d2 hibernate-core-4.2.0.Final-redhat-1-BZ-991581.jar d6020f8a16feb5ca50b39b105c1acde9 module.xml
https://access.redhat.com/jbossnetwork/restricted/softwareDetail.html?softwareId=24733&product=appplatform&version=6.1.0&downloadType=patches