Hello,
I'm running into an issue where the DDL that hibernate generates is generating constraints with names that exceed the 30 character name limit that Oracle imposes. The foreign key name itself isn't the issue, but it seems that an identifier is being tacked on to the end of the foreign key constraint name.
So for example I have this mapping:
Code:
<class name="com.blah.AbstractSeatingCode" table="ABSTRACT_SEATING_CODE" dynamic-insert="false"
dynamic-update="false" abstract="true">
<id name="id" type="java.lang.String" unsaved-value="null">
<column name="ABSTRACTSEATINGCODE_ID" sql-type="VARCHAR2(22)" />
<generator class="com.tickets.common.util.hibernate.IdGenerator" />
</id>
<many-to-one name="supplier" class="com.blah.Supplier"
foreign-key="ABSTRACT_SEATING_CODE_SUPPLIER" lazy="proxy" fetch="select">
<column name="SUPPLIER" not-null="false" sql-type="VARCHAR2(22)" />
</many-to-one>
<union-subclass name="com.blah.Aspect" table="ASPECT" dynamic-insert="false"
dynamic-update="false" abstract="false">
<property name="aspectType" type="aspectType" column="ASPECT_TYPE_ID" not-null="true" />
</union-subclass>
</class>
When I generated the schema, the table generation was fine. But I get the following constraint generated:
Code:
alter table ASPECT
add constraint ABSTRACT_SEATING_CODE_SUPPLIER73a20858
foreign key (SUPPLIER_ID)
references SUPPLIER;
Notice the constraint name exceeds 30 characters. Now the original name of the foreign key (ABSTRACT_SEATING_CODE_SUPPLIER) is less then 30 characters. '73a20858' is added to the end of the constraint name. So I'm just wondering why that's happening and is there anyway to tell hibernate to truncate the name at 30 characters? I did notice that other constraints whose foreign key length was greater then 30 characters were truncated automatically.
Any help would be greatly appreciated.
John[/code]