From: Andrea A. (JIRA) <no...@at...> - 2006-07-07 16:36:59
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-355?page=comments#action_23573 ] Andrea Aime commented on HHH-355: --------------------------------- While I don't have a simple example, I can tell you how this long names are created. I do have a hierarchy mapped with the table per class approach, with intermediate abstract classes. Leaf classes of this hierarchy are apparently managed in hibernate usign the DenormalizedTable class. The code that generates the foreign keys for this class is: public void createForeignKeys() { includedTable.createForeignKeys(); Iterator iter = includedTable.getForeignKeyIterator(); while ( iter.hasNext() ) { ForeignKey fk = (ForeignKey) iter.next(); createForeignKey( fk.getName() + Integer.toHexString( getName().hashCode() ), fk.getColumns(), fk.getReferencedEntityName() ); } } As you can see, it gets the foreign key name of the contained class, and appends another hexstring. This name can become really long if the hierarchy has many levels. In my case I get names as long as: FK14F780C41886F83e63ff56e238e868d73630607 > Identifier is too long > ---------------------- > > Key: HHH-355 > URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-355 > Project: Hibernate3 > Type: Bug > Components: core > Versions: 3.0 final > Environment: Oracle 9, JDK 1.5 > Reporter: Tim McCune > > > SchemaUpdate is trying to create a foreign key constraint whose name is too long for Oracle: > 2005-04-15 12:25:26,444 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] Unsuccessful: alter table LoadDescriptor add constraint FK18D5ABAD371DC5BAba9c69f2d683d915 foreign key (parent) references Workspace > 2005-04-15 12:25:26,444 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] [Oracle] #60 ORA-00972: identifier is too long -- 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.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |