HHH-18358 Properly resolving entity type literal in named query while generating metamodel

This commit is contained in:
Čedomir Igaly 2024-07-09 10:13:32 +02:00 committed by Gavin King
parent e71f874e1f
commit fc6fca3435
2 changed files with 18 additions and 0 deletions

View File

@ -280,6 +280,8 @@ public abstract class MockSessionFactory
abstract boolean isEntityDefined(String entityName);
abstract String findEntityName(String typeName);
abstract String qualifyName(String entityName);
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
public String qualifyImportableName(String queryName) {
if (isClassDefined(queryName)) {

View File

@ -425,6 +425,16 @@ public abstract class ProcessorSessionFactory extends MockSessionFactory {
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
String qualifyName(String entityName) {
TypeElement entityClass = findEntityClass(entityName);