mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-09 12:44:49 +00:00
HHH-9280 : Table name generated for @ElementCollection uses owning entity class name instead of mapped entity name
(cherry picked from commit ccffe0dea9d9d4aae05ffaaa9239ff5ac5b3346a)
This commit is contained in:
parent
4732c04f10
commit
9f8f07c229
@ -1140,7 +1140,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;
|
||||
|
||||
@ -260,6 +261,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