mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-08 04:08:19 +00:00
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 @@ else if ( anyAnn != null ) {
|
||||
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.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 void testDefaultFKNameForElementCollection() throws Exception {
|
||||
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 @@
|
||||
/**
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
@Entity
|
||||
@Entity(name="Mtx")
|
||||
public class Matrix {
|
||||
@Id
|
||||
@GeneratedValue
|
||||
|
Loading…
x
Reference in New Issue
Block a user