[hibernate-commits] Hibernate SVN: r18415 - core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Tue Jan 5 13:00:34 EST 2010


Author: epbernard
Date: 2010-01-05 13:00:34 -0500 (Tue, 05 Jan 2010)
New Revision: 18415

Modified:
   core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/TableBinder.java
Log:
HHH-4753 Default table name for @CollectionTable is not inferred correctly according to spec requirement. Legacy names still supported. Fixing NPE in some cases

Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/TableBinder.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/TableBinder.java	2010-01-05 16:55:15 UTC (rev 18414)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/TableBinder.java	2010-01-05 18:00:34 UTC (rev 18415)
@@ -144,7 +144,9 @@
 		final String unquotedAssocTable = StringHelper.unquote( associatedEntityTable );
 
 		//@ElementCollection use ownerEntity_property instead of the cleaner ownerTableName_property
-		final String ownerObjectName = isJPA2ElementCollection ? StringHelper.unqualify( ownerEntity ) : unquotedOwnerTable;
+		// ownerEntity can be null when the table name is explicitly set
+		final String ownerObjectName = isJPA2ElementCollection && ownerEntity != null ?
+				StringHelper.unqualify( ownerEntity ) : unquotedOwnerTable;
 		final ObjectNameSource nameSource = buildNameContext( 
 				ownerObjectName,
 				unquotedAssocTable );



More information about the hibernate-commits mailing list