if ( criteria instanceof CriteriaImpl ) {
String targetEntity = ( (CriteriaImpl) criteria ).getEntityOrClassName();
if ( entityType == null ) {
ServiceManager serviceManager = searchFactoryImplementor.getServiceManager();
try {
ClassLoaderService classLoaderService = serviceManager.requestService( ClassLoaderService.class );
entityType = classLoaderService.classForName( targetEntity );
}
catch (ClassLoadingException e) {
throw new SearchException( "Unable to load entity class from criteria: " + targetEntity, e );
}