HHH-18358 Properly resolving entity type literal in named query while generating metamodel
This commit is contained in:
parent
e71f874e1f
commit
fc6fca3435
|
@ -280,6 +280,8 @@ public abstract class MockSessionFactory
|
||||||
|
|
||||||
abstract boolean isEntityDefined(String entityName);
|
abstract boolean isEntityDefined(String entityName);
|
||||||
|
|
||||||
|
abstract String findEntityName(String typeName);
|
||||||
|
|
||||||
abstract String qualifyName(String entityName);
|
abstract String qualifyName(String entityName);
|
||||||
|
|
||||||
abstract boolean isAttributeDefined(String entityName, String fieldName);
|
abstract boolean isAttributeDefined(String entityName, String fieldName);
|
||||||
|
@ -801,6 +803,12 @@ public abstract class MockSessionFactory
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <X> ManagedDomainType<X> managedType(String typeName) {
|
||||||
|
final String entityName = findEntityName( typeName );
|
||||||
|
return entityName == null ? null : entity( entityName );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String qualifyImportableName(String queryName) {
|
public String qualifyImportableName(String queryName) {
|
||||||
if (isClassDefined(queryName)) {
|
if (isClassDefined(queryName)) {
|
||||||
|
|
|
@ -425,6 +425,16 @@ public abstract class ProcessorSessionFactory extends MockSessionFactory {
|
||||||
return findEntityClass(entityName) != null;
|
return findEntityClass(entityName) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
String findEntityName(String typeName) {
|
||||||
|
for ( final Map.Entry<String, String> e : entityNameMappings.entrySet() ) {
|
||||||
|
if ( typeName.equals( e.getKey() ) || typeName.equals( e.getValue() ) ) {
|
||||||
|
return e.getKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
String qualifyName(String entityName) {
|
String qualifyName(String entityName) {
|
||||||
TypeElement entityClass = findEntityClass(entityName);
|
TypeElement entityClass = findEntityClass(entityName);
|
||||||
|
|
Loading…
Reference in New Issue