Missing many-to-one relationships in which foreign key references a unique key in the one side

Description

In the reverse engineering process, Hibernate Tools is missing many-to-one relationships in which foreign key references a unique key in the one side.

Here is a test case: table detail has a foreign key to table master, and references a column that has a unique constraint (uk_master).

Now, when executing Hibernate Tools with OracleMetaDataDialect, this relationship is not captured by the metadata query issued by OracleMetaDataDialect (constant SQL_FK_BASE). This is so because OracleMetaDataDialect is restricting foreign key relationships only to primary key constraints:

If we change this restriction so that it includes also unique key constraints, it works:

As far as I know, this change doesn't have side effects.

There is a patch attached.

(If you need, I can zip a simple maven project with this test case.)

Environment

jdk1.5.0_11 hibernate-tools-3.2.4.GA hibernate-core-3.3.2.GA Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production Oracle JDBC driver, version: 11.2.0.1.0

Attachments

1

Activity

Show:

Details

Assignee

Reporter

Bug Testcase Reminder (view)

Bug reports should generally be accompanied by a test case!

Bug Testcase Reminder (edit)

Bug reports should generally be accompanied by a test case!

Participants

Rui Baeta

Components

Affects versions

Priority

Created June 2, 2011 at 10:49 AM
Updated December 10, 2024 at 3:03 PM