-->
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.  [ 5 posts ] 
Author Message
 Post subject: Foreign key constraint name length
PostPosted: Mon Sep 12, 2005 6:07 am 
Newbie

Joined: Mon Sep 12, 2005 5:32 am
Posts: 3
Location: CSC Scientific Computing
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.0.5

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using: Oracle 10.g 1

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

I am using Andromda 3.1 RC1 to generate Hibernate schema.
Andromda allows me to select different ways to implement the inheritance
hierarchy, but it seems that union-subclass suites us. However,
Hibernate generates foreign key constraint names that are too long to
Oracle (Andromda has a property that controls entity table names). The
constraint names are of form:

dessec6a2d0e56e0a54a923af18ae54a257eb

Actually the name should be DESCRIBABLE_SECURITY_FKCc6a2d0e56e0a54a923af18ae54a257eb,
but I tried Andomda's feature @andromda.persistence.foreignkey.constraint that let's you change
the name (I used name DESSEC). But when you count the characters,
it is still too long (Oracle has limit 30).

So question is: is there any way to make Hibernate use some other
way to name the constraints; running counter or similar?

_________________
Arto Viitanen
Finland


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 12, 2005 6:48 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
just set the name explicitly with foreign-key attribute

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 13, 2005 2:00 am 
Newbie

Joined: Mon Sep 12, 2005 5:32 am
Posts: 3
Location: CSC Scientific Computing
Quote:
just set the name explicitly with foreign-key attribute


The @andromda.persitence.foreignkey.constraint does exaclty that.
However since there will be several foreignkey constraints onto the
database per one foreignkey in the mapping, Hibernate makes up
its own names.

_________________
Arto Viitanen
Finland


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 13, 2005 2:33 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
huh?

all foreign-key generation names in hibernate are controllable AFAIK....maybe andromeda does soemthing funny ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 13, 2005 7:25 am 
Newbie

Joined: Mon Sep 12, 2005 5:32 am
Posts: 3
Location: CSC Scientific Computing
Quote:
all foreign-key generation names in hibernate are controllable AFAIK....maybe andromeda does soemthing funny ?


It seems you are right. I tried with a simple UML model

Dong --- Foo
^
/\
/ \
Biu Bar

that is, Foo is an abstract class with two subclasses Biu and Bar. Dong
has an association to Foo named fooSet. When I generated
the hibernate job, I got constraint names of form foosetf045; that is
association name and four hexadecimal numbers. But when I moved
Bar as a subclass of Biu, there came eight hexadecimal numbers.

Since in the original model (MageOM; if you know about bioinformatics)
has quite long a inheritance path, the hexadecimal numbers were quite
long.

_________________
Arto Viitanen
Finland


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

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.