HHH-1904 Hash the natural id unique key names
This commit is contained in:
parent
721016cccb
commit
06ab065272
|
@ -155,6 +155,7 @@ import org.hibernate.id.SequenceHiLoGenerator;
|
|||
import org.hibernate.id.TableHiLoGenerator;
|
||||
import org.hibernate.id.enhanced.SequenceStyleGenerator;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.mapping.Any;
|
||||
import org.hibernate.mapping.Component;
|
||||
import org.hibernate.mapping.DependantValue;
|
||||
|
@ -2097,12 +2098,12 @@ public final class AnnotationBinder {
|
|||
if ( naturalIdAnn != null ) {
|
||||
if ( joinColumns != null ) {
|
||||
for ( Ejb3Column column : joinColumns ) {
|
||||
column.addUniqueKey( "_UniqueKey", inSecondPass );
|
||||
column.addUniqueKey( StringHelper.randomFixedLengthHex("UK_"), inSecondPass );
|
||||
}
|
||||
}
|
||||
else {
|
||||
for ( Ejb3Column column : columns ) {
|
||||
column.addUniqueKey( "_UniqueKey", inSecondPass );
|
||||
column.addUniqueKey( StringHelper.randomFixedLengthHex("UK_"), inSecondPass );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2247,7 +2247,7 @@ public final class HbmBinder {
|
|||
}
|
||||
else if ( "natural-id".equals( name ) ) {
|
||||
UniqueKey uk = new UniqueKey();
|
||||
uk.setName("_UniqueKey");
|
||||
uk.setName(StringHelper.randomFixedLengthHex("UK_"));
|
||||
uk.setTable(table);
|
||||
//by default, natural-ids are "immutable" (constant)
|
||||
boolean mutableId = "true".equals( subnode.attributeValue("mutable") );
|
||||
|
|
Loading…
Reference in New Issue