Bug 991578
| Summary: | HHH-8390 Foreign key reference generated before unique constraint exists | |||
|---|---|---|---|---|
| Product: | [JBoss] JBoss Enterprise Application Platform 6 | Reporter: | Ricardo Martinelli de Oliveira <rmartine> | |
| Component: | Hibernate | Assignee: | Brett Meyer <brmeyer> | |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Zbyněk Roubalík <zroubali> | |
| Severity: | high | Docs Contact: | Russell Dickenson <rdickens> | |
| Priority: | high | |||
| Version: | 6.1.0 | CC: | lcosti, theute | |
| Target Milestone: | ER1 | |||
| Target Release: | EAP 6.2.0 | |||
| Hardware: | Unspecified | |||
| OS: | Unspecified | |||
| Whiteboard: | ||||
| Fixed In Version: | Doc Type: | Bug Fix | ||
| Doc Text: |
Creating a schema in which a foreign key was declared before it was defined as unique or as a primary key, would fail on Oracle and possibly other dialects.
This issue has been fixed in this release of JBoss EAP 6 by forcing unique key constraints to be created before foreign key constraints as part of the schema export process.
As a result, exported schemas should no longer fail on Oracle because of a foreign key being declared before a unique constraint exists.
|
Story Points: | --- | |
| Clone Of: | ||||
| : | 991581 (view as bug list) | Environment: | ||
| Last Closed: | 2013-12-15 16:13:23 UTC | Type: | Bug | |
| Regression: | --- | Mount Type: | --- | |
| Documentation: | --- | CRM: | ||
| Verified Versions: | Category: | --- | ||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
| Cloudforms Team: | --- | Target Upstream Version: | ||
| Embargoed: | ||||
| Bug Depends On: | ||||
| Bug Blocks: | 991581, 999686 | |||
Fix pushed to http://git.app.eng.bos.redhat.com/?p=hibernate/hibernate-core.git;a=shortlog;h=refs/heads/eap61-cp-updates EAP 6.2.0.ER1 |
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