Author: stliu
Date: 2010-04-25 22:06:03 -0400 (Sun, 25 Apr 2010)
New Revision: 19292
Modified:
core/branches/Branch_3_5/annotations/src/main/java/org/hibernate/cfg/Ejb3Column.java
Log:
HHH-4773 @CollectionId does not force the id column to not-null
Modified:
core/branches/Branch_3_5/annotations/src/main/java/org/hibernate/cfg/Ejb3Column.java
===================================================================
---
core/branches/Branch_3_5/annotations/src/main/java/org/hibernate/cfg/Ejb3Column.java 2010-04-26
02:03:34 UTC (rev 19291)
+++
core/branches/Branch_3_5/annotations/src/main/java/org/hibernate/cfg/Ejb3Column.java 2010-04-26
02:06:03 UTC (rev 19292)
@@ -439,10 +439,11 @@
column.setPropertyName(
BinderHelper.getRelativePath( propertyHolder, inferredData.getPropertyName() )
);
- column.setNullable(
- col.nullable()
- ); //TODO force to not null if available? This is a (bad) user choice.
- column.setUnique( col.unique() );
+ //although in theory, null is an acceptable value in a Map key
+ //we need force this column to be not null, as it intended to be the primary key.
+ if ( nullability != Nullability.FORCED_NULL ) {
+ column.setNullable( false );
+ } column.setUnique( col.unique() );
column.setInsertable( col.insertable() );
column.setUpdatable( col.updatable() );
column.setSecondaryTableName( tableName );
Show replies by date