-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Oracle 30 character limit
PostPosted: Thu Dec 22, 2005 2:41 pm 
Newbie

Joined: Tue Jun 07, 2005 1:08 pm
Posts: 10
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]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.