HHH-9280 : Table name generated for @ElementCollection uses owning entity class name instead of mapped entity name
This commit is contained in:
parent
ee0cf672d7
commit
ccffe0dea9
|
@ -1214,7 +1214,7 @@ public abstract class CollectionBinder {
|
|||
if ( StringHelper.isEmpty( associationTableBinder.getName() ) ) {
|
||||
//default value
|
||||
associationTableBinder.setDefaultName(
|
||||
collValue.getOwner().getEntityName(),
|
||||
collValue.getOwner().getJpaEntityName(),
|
||||
mappings.getLogicalTableName( collValue.getOwner().getTable() ),
|
||||
collectionEntity != null ? collectionEntity.getEntityName() : null,
|
||||
collectionEntity != null ? mappings.getLogicalTableName( collectionEntity.getTable() ) : null,
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.hibernate.Session;
|
|||
import org.hibernate.Transaction;
|
||||
import org.hibernate.mapping.Collection;
|
||||
import org.hibernate.mapping.Column;
|
||||
import org.hibernate.mapping.Table;
|
||||
import org.hibernate.test.annotations.Country;
|
||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||
|
||||
|
@ -261,6 +262,13 @@ public class CollectionElementTest extends BaseCoreFunctionalTestCase {
|
|||
isCollectionColumnPresent( Boy.class.getName(), "hatedNames", "Boy_id" );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefaultTableNameUsesJpaEntityName() {
|
||||
final Collection collection = configuration().getCollectionMapping( Matrix.class.getName() + "." + "mvalues" );
|
||||
final Table table = collection.getCollectionTable();
|
||||
assertEquals( "Mtx_mvalues", table.getName() );
|
||||
}
|
||||
|
||||
private void isLegacyValueCollectionColumnPresent(String collectionHolder, String propertyName) {
|
||||
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import org.hibernate.annotations.Type;
|
|||
/**
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
@Entity
|
||||
@Entity(name="Mtx")
|
||||
public class Matrix {
|
||||
@Id
|
||||
@GeneratedValue
|
||||
|
|
Loading…
Reference in New Issue