return returnValue;
}
public Query createNativeQuery(String sqlString, Class resultClass) {
Query returnValue = null;
Agent callFlowAgent = Switch.getSwitch().getCallFlowAgent();
try {
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerMethodStart(EntityManagerMethod.CREATE_NATIVE_QUERY_STRING_CLASS);
}
EntityManager delegate = _getDelegate();
returnValue = delegate.createNativeQuery(sqlString, resultClass);
if( nonTxEntityManager != null ) {
Query queryDelegate = returnValue;
returnValue = QueryWrapper.createNativeQueryWrapper
(entityManagerFactory, emProperties, delegate,
queryDelegate, sqlString, resultClass);
// It's now the responsibility of the QueryWrapper to
// close the non-tx EM delegate
nonTxEntityManager = null;
}
} catch(RuntimeException re) {
if( nonTxEntityManager != null ) {
cleanupNonTxEntityManager();
}
throw re;
} finally {
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerMethodEnd();
}
}
return returnValue;
}