I'm running the Hibernate Tools against a DB2 database that permits the same foreign key name to be used in two different tables, each related to the same PK in another table. When the tool attempts to read the schema, it throws the following exception:
org.jboss.tools.hibernate.spi.HibernateException: Foreign key name (EXECUTION_FK) mapped to different tables! previous: org.hibernate.mapping.Table(PURGE_EXECUTION_TRACKING) current:org.hibernate.mapping.Table(PURGE_SCENARIO_TRACKING)
at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter$2.execute(LazyDatabaseSchemaWorkbenchAdapter.java:138)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:108)
at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.readDatabaseSchema(LazyDatabaseSchemaWorkbenchAdapter.java:125)
at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.getChildren(LazyDatabaseSchemaWorkbenchAdapter.java:65)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:104)
It should be possible to rename one of the FKs, but this is a large database and there appear to be many of these conflicts.
Has anyone found a workaround inside Hibernate that would allow reading the schema without choking on the exception?
I haven't found a configuration parameter to turn off this check, or any class overrides that would address this. It's also not clear if the Hibernate tools would be able to perform their reverse engineering functions if this exception could be ignored.