HHH-4753 Default table name for @CollectionTable is not inferred correctly according to spec requirement. Legacy names still supported. Fixing NPE in some cases

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@18415 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Emmanuel Bernard 2010-01-05 18:00:34 +00:00
parent a3dd6de70f
commit 39dd795e40
1 changed files with 3 additions and 1 deletions

View File

@ -144,7 +144,9 @@ public class TableBinder {
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 );