-->
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: Controlling Hibernate's Generation of Foreign Keys and Index
PostPosted: Mon Sep 27, 2010 1:09 pm 
Newbie

Joined: Mon Dec 11, 2006 8:28 am
Posts: 13
I'm using the EnversHibernateToolTask ant task to generate a schema from my annotated classes, using the MySQL5InnoDBDialect dialect. When it sees a construct like this:

Code:
    @ManyToOne
    @JoinColumn(name="FK_TO_OTHER")

private Other other;

it generates the following:

Code:
    alter table This
        add index FK8EA4BB54F8923F8E (FK_TO_OTHER),
        add constraint FK8EA4BB54F8923F8E
        foreign key (FK_TO_OTHER)
        references Other (OTHER_ID);

    How can I get more readable index and FK names?
    How can I control whether the index gets generated?

I noticed, btw, the if I put an @Index annotation on the field, the task generates both indices - the one that I specified in the annotation and the one that accompanies the FK.

TIA

Michael

_________________
Michael Berkowitz


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.