HHH-8221 - mocking orm.xml is not processed well
This commit is contained in:
parent
262c109e64
commit
72291316fc
|
@ -3378,7 +3378,14 @@ public class Binder {
|
|||
tableIdentifier = referencedEntityBinding.getPrimaryTable().getLogicalName();
|
||||
}
|
||||
|
||||
Schema schema = metadata.getDatabase().getSchema( logicalCatalogName, logicalSchemaName );
|
||||
|
||||
Identifier catalogName = StringHelper.isNotEmpty( logicalCatalogName ) ?
|
||||
Identifier.toIdentifier( logicalCatalogName )
|
||||
: referencedEntityBinding.getPrimaryTable().getSchema().getName().getCatalog();
|
||||
Identifier schemaName = StringHelper.isNotEmpty( logicalCatalogName ) ?
|
||||
Identifier.toIdentifier( logicalSchemaName )
|
||||
: referencedEntityBinding.getPrimaryTable().getSchema().getName().getSchema();
|
||||
Schema schema = metadata.getDatabase().getSchema( catalogName, schemaName );
|
||||
return schema.locateTable( tableIdentifier );
|
||||
}
|
||||
|
||||
|
|
|
@ -43,11 +43,12 @@ import org.hibernate.metamodel.internal.source.annotations.xml.mocker.MockHelper
|
|||
class ExclusiveAnnotationFilter extends AbstractAnnotationFilter {
|
||||
|
||||
public static ExclusiveAnnotationFilter INSTANCE = new ExclusiveAnnotationFilter();
|
||||
private DotName[] targetNames;
|
||||
private List<ExclusiveGroup> exclusiveGroupList;
|
||||
private final DotName[] targetNames;
|
||||
private final List<ExclusiveGroup> exclusiveGroupList;
|
||||
|
||||
private ExclusiveAnnotationFilter() {
|
||||
this.exclusiveGroupList = getExclusiveGroupList();
|
||||
this.exclusiveGroupList = new ArrayList<ExclusiveGroup>();
|
||||
fillExclusiveGroupList();
|
||||
Set<DotName> names = new HashSet<DotName>();
|
||||
for ( ExclusiveGroup group : exclusiveGroupList ) {
|
||||
names.addAll( group.getNames() );
|
||||
|
@ -55,9 +56,7 @@ class ExclusiveAnnotationFilter extends AbstractAnnotationFilter {
|
|||
targetNames = names.toArray( new DotName[names.size()] );
|
||||
}
|
||||
|
||||
private List<ExclusiveGroup> getExclusiveGroupList() {
|
||||
if ( exclusiveGroupList == null ) {
|
||||
exclusiveGroupList = new ArrayList<ExclusiveGroup>();
|
||||
private void fillExclusiveGroupList() {
|
||||
ExclusiveGroup group = new ExclusiveGroup();
|
||||
group.add( ENTITY );
|
||||
group.add( MAPPED_SUPERCLASS );
|
||||
|
@ -113,8 +112,6 @@ class ExclusiveAnnotationFilter extends AbstractAnnotationFilter {
|
|||
group.scope = Scope.ATTRIBUTE;
|
||||
exclusiveGroupList.add( group );
|
||||
|
||||
}
|
||||
return exclusiveGroupList;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -39,20 +39,20 @@ class NameAnnotationFilter extends AbstractAnnotationFilter {
|
|||
indexedAnnotationInstanceList.clear();
|
||||
}
|
||||
|
||||
public static NameTargetAnnotationFilter INSTANCE = new NameTargetAnnotationFilter();
|
||||
|
||||
public static NameAnnotationFilter INSTANCE = new NameAnnotationFilter();
|
||||
private static final DotName[] TARGET_ANNOTATIONS = new DotName[] {
|
||||
CACHEABLE,
|
||||
TABLE,
|
||||
EXCLUDE_DEFAULT_LISTENERS,
|
||||
EXCLUDE_SUPERCLASS_LISTENERS,
|
||||
ID_CLASS,
|
||||
INHERITANCE,
|
||||
DISCRIMINATOR_VALUE,
|
||||
DISCRIMINATOR_COLUMN,
|
||||
ENTITY_LISTENERS
|
||||
};
|
||||
@Override
|
||||
protected DotName[] targetAnnotation() {
|
||||
return new DotName[] {
|
||||
CACHEABLE,
|
||||
TABLE,
|
||||
EXCLUDE_DEFAULT_LISTENERS,
|
||||
EXCLUDE_SUPERCLASS_LISTENERS,
|
||||
ID_CLASS,
|
||||
INHERITANCE,
|
||||
DISCRIMINATOR_VALUE,
|
||||
DISCRIMINATOR_COLUMN,
|
||||
ENTITY_LISTENERS
|
||||
};
|
||||
return TARGET_ANNOTATIONS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,46 +50,46 @@ class NameTargetAnnotationFilter extends AbstractAnnotationFilter {
|
|||
}
|
||||
|
||||
public static NameTargetAnnotationFilter INSTANCE = new NameTargetAnnotationFilter();
|
||||
|
||||
private static final DotName[] TARGET_ANNOTATIONS = new DotName[] {
|
||||
JPADotNames.LOB,
|
||||
JPADotNames.ID,
|
||||
JPADotNames.BASIC,
|
||||
JPADotNames.GENERATED_VALUE,
|
||||
JPADotNames.VERSION,
|
||||
JPADotNames.TRANSIENT,
|
||||
JPADotNames.ACCESS,
|
||||
JPADotNames.POST_LOAD,
|
||||
JPADotNames.POST_PERSIST,
|
||||
JPADotNames.POST_REMOVE,
|
||||
JPADotNames.POST_UPDATE,
|
||||
JPADotNames.PRE_PERSIST,
|
||||
JPADotNames.PRE_REMOVE,
|
||||
JPADotNames.PRE_UPDATE,
|
||||
JPADotNames.EMBEDDED_ID,
|
||||
JPADotNames.EMBEDDED,
|
||||
JPADotNames.MANY_TO_ONE,
|
||||
JPADotNames.MANY_TO_MANY,
|
||||
JPADotNames.ONE_TO_ONE,
|
||||
JPADotNames.ONE_TO_MANY,
|
||||
JPADotNames.ELEMENT_COLLECTION,
|
||||
JPADotNames.COLLECTION_TABLE,
|
||||
JPADotNames.COLUMN,
|
||||
JPADotNames.ENUMERATED,
|
||||
JPADotNames.JOIN_TABLE,
|
||||
JPADotNames.TEMPORAL,
|
||||
JPADotNames.ORDER_BY,
|
||||
JPADotNames.ORDER_COLUMN,
|
||||
JPADotNames.JOIN_COLUMN,
|
||||
JPADotNames.JOIN_COLUMNS,
|
||||
JPADotNames.MAPS_ID,
|
||||
JPADotNames.MAP_KEY_TEMPORAL,
|
||||
JPADotNames.MAP_KEY,
|
||||
JPADotNames.MAP_KEY_CLASS,
|
||||
JPADotNames.MAP_KEY_COLUMN,
|
||||
JPADotNames.MAP_KEY_ENUMERATED
|
||||
};
|
||||
@Override
|
||||
protected DotName[] targetAnnotation() {
|
||||
return new DotName[] {
|
||||
JPADotNames.LOB,
|
||||
JPADotNames.ID,
|
||||
JPADotNames.BASIC,
|
||||
JPADotNames.GENERATED_VALUE,
|
||||
JPADotNames.VERSION,
|
||||
JPADotNames.TRANSIENT,
|
||||
JPADotNames.ACCESS,
|
||||
JPADotNames.POST_LOAD,
|
||||
JPADotNames.POST_PERSIST,
|
||||
JPADotNames.POST_REMOVE,
|
||||
JPADotNames.POST_UPDATE,
|
||||
JPADotNames.PRE_PERSIST,
|
||||
JPADotNames.PRE_REMOVE,
|
||||
JPADotNames.PRE_UPDATE,
|
||||
JPADotNames.EMBEDDED_ID,
|
||||
JPADotNames.EMBEDDED,
|
||||
JPADotNames.MANY_TO_ONE,
|
||||
JPADotNames.MANY_TO_MANY,
|
||||
JPADotNames.ONE_TO_ONE,
|
||||
JPADotNames.ONE_TO_MANY,
|
||||
JPADotNames.ELEMENT_COLLECTION,
|
||||
JPADotNames.COLLECTION_TABLE,
|
||||
JPADotNames.COLUMN,
|
||||
JPADotNames.ENUMERATED,
|
||||
JPADotNames.JOIN_TABLE,
|
||||
JPADotNames.TEMPORAL,
|
||||
JPADotNames.ORDER_BY,
|
||||
JPADotNames.ORDER_COLUMN,
|
||||
JPADotNames.JOIN_COLUMN,
|
||||
JPADotNames.JOIN_COLUMNS,
|
||||
JPADotNames.MAPS_ID,
|
||||
JPADotNames.MAP_KEY_TEMPORAL,
|
||||
JPADotNames.MAP_KEY,
|
||||
JPADotNames.MAP_KEY_CLASS,
|
||||
JPADotNames.MAP_KEY_COLUMN,
|
||||
JPADotNames.MAP_KEY_ENUMERATED
|
||||
};
|
||||
return TARGET_ANNOTATIONS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,12 +34,10 @@ import org.hibernate.engine.spi.SessionImplementor;
|
|||
import org.hibernate.jpa.AvailableSettings;
|
||||
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
|
||||
|
||||
/**
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
@FailureExpectedWithNewMetamodel
|
||||
public class XmlTest extends BaseEntityManagerFunctionalTestCase {
|
||||
@Test
|
||||
public void testXmlMappingCorrectness() throws Exception {
|
||||
|
|
|
@ -29,16 +29,13 @@ import org.junit.Test;
|
|||
|
||||
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
||||
|
||||
import org.hibernate.jpa.test.xml.*;
|
||||
import org.hibernate.testing.DialectChecks;
|
||||
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
|
||||
import org.hibernate.testing.RequiresDialectFeature;
|
||||
|
||||
/**
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
@RequiresDialectFeature( DialectChecks.SupportsSequences.class )
|
||||
@FailureExpectedWithNewMetamodel
|
||||
public class XmlTest extends BaseEntityManagerFunctionalTestCase {
|
||||
@Test
|
||||
public void testXmlMappingCorrectness() throws Exception {
|
||||
|
|
Loading…
Reference in New Issue