-->
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: SchemaUpdate ignores unique constraints (after HHH-7797)
PostPosted: Fri Mar 15, 2013 7:37 am 
Newbie

Joined: Fri Nov 09, 2012 8:40 am
Posts: 2
There is a change in default behavior of SchemaUpdate - now SchemaUpdate ignores unique constraints on columns.
Is this expected behavior?


In detail:
Before version 4.1.10 SchemaUpdate created unique constraints for column (indirectly, in Table.sqlAlterStrings):
Code:
    boolean useUniqueConstraint = column.isUnique() &&
        dialect.supportsUnique() &&
        ( column.isNullable() || dialect.supportsNotNullUnique() );
    if ( useUniqueConstraint ) {
        alter.append( " unique" );
}


And this code in version 4.1.10:
Code:
if ( column.isUnique() ) {
    UniqueKey uk = getOrCreateUniqueKey(
            column.getQuotedName( dialect ) + '_' );
    uk.addColumn( column );
    alter.append( dialect.getUniqueDelegate()
            .applyUniqueToColumn( column ) );
}


As it was said in HHH-7797: "The default delegate creates unique constraints in separate "alter table" statements."
But Configuration.generateSchemaUpdateScript ignores table.getUniqueKeyIterator() That's why unique constraint aren't created.


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.