Methods Summary |
---|
private void | clearDelegates()
queryDelegate = null;
if( entityManagerDelegate != null ) {
entityManagerDelegate.close();
entityManagerDelegate = null;
}
|
public static javax.persistence.Query | createNamedQueryWrapper(javax.persistence.EntityManagerFactory emf, java.util.Map emProperties, javax.persistence.EntityManager emDelegate, javax.persistence.Query queryDelegate, java.lang.String name)
return new QueryWrapper(emf, emProperties, emDelegate,
queryDelegate, QueryType.NAMED,
name, null, null);
|
public static javax.persistence.Query | createNativeQueryWrapper(javax.persistence.EntityManagerFactory emf, java.util.Map emProperties, javax.persistence.EntityManager emDelegate, javax.persistence.Query queryDelegate, java.lang.String sqlString)
return new QueryWrapper(emf, emProperties, emDelegate,
queryDelegate, QueryType.NATIVE,
sqlString, null, null);
|
public static javax.persistence.Query | createNativeQueryWrapper(javax.persistence.EntityManagerFactory emf, java.util.Map emProperties, javax.persistence.EntityManager emDelegate, javax.persistence.Query queryDelegate, java.lang.String sqlString, java.lang.Class resultClass)
return new QueryWrapper(emf, emProperties, emDelegate,
queryDelegate, QueryType.NATIVE,
sqlString, resultClass, null);
|
public static javax.persistence.Query | createNativeQueryWrapper(javax.persistence.EntityManagerFactory emf, java.util.Map emProperties, javax.persistence.EntityManager emDelegate, javax.persistence.Query queryDelegate, java.lang.String sqlString, java.lang.String resultSetMapping)
return new QueryWrapper(emf, emProperties, emDelegate,
queryDelegate, QueryType.NATIVE,
sqlString, null, resultSetMapping);
|
public static javax.persistence.Query | createQueryWrapper(javax.persistence.EntityManagerFactory emf, java.util.Map emProperties, javax.persistence.EntityManager emDelegate, javax.persistence.Query queryDelegate, java.lang.String ejbqlString)
return new QueryWrapper(emf, emProperties, emDelegate,
queryDelegate, QueryType.EJBQL,
ejbqlString, null, null);
|
public int | executeUpdate()
Agent callFlowAgent = Switch.getSwitch().getCallFlowAgent();
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryStart(EntityManagerQueryMethod.EXECUTE_UPDATE);
callFlowAgent.entityManagerQueryEnd();
}
throw new TransactionRequiredException("executeUpdate is not supported for a Query object obtained through non-transactional access of a container-managed transactional EntityManager");
|
private javax.persistence.Query | getQueryDelegate()
if( queryDelegate == null ) {
entityManagerDelegate =
entityMgrFactory.createEntityManager(entityMgrProperties);
switch(queryType) {
case EJBQL :
queryDelegate =
entityManagerDelegate.createQuery(queryString);
break;
case NAMED :
queryDelegate =
entityManagerDelegate.createNamedQuery(queryString);
break;
case NATIVE :
if( queryResultClass != null ) {
queryDelegate = entityManagerDelegate.createNativeQuery
(queryString, queryResultClass);
} else if( queryResultSetMapping != null ) {
queryDelegate = entityManagerDelegate.createNativeQuery
(queryString, queryResultSetMapping);
} else {
queryDelegate = entityManagerDelegate.createNativeQuery
(queryString);
}
break;
}
// Now recreate the sequence of valid setter invocations applied
// to this query.
for(SetterData setterData : setterInvocations) {
setterData.apply(queryDelegate);
}
}
return queryDelegate;
|
public java.util.List | getResultList()
Agent callFlowAgent = Switch.getSwitch().getCallFlowAgent();
try {
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryStart(EntityManagerQueryMethod.GET_RESULT_LIST);
}
Query delegate = getQueryDelegate();
return delegate.getResultList();
} finally {
clearDelegates();
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryEnd();
}
}
|
public java.lang.Object | getSingleResult()
Agent callFlowAgent = Switch.getSwitch().getCallFlowAgent();
try {
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryStart(EntityManagerQueryMethod.GET_SINGLE_RESULT);
}
Query delegate = getQueryDelegate();
return delegate.getSingleResult();
} finally {
clearDelegates();
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryEnd();
}
}
|
public javax.persistence.Query | setFirstResult(int startPosition)
Agent callFlowAgent = Switch.getSwitch().getCallFlowAgent();
try {
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryStart(EntityManagerQueryMethod.SET_FIRST_RESULT);
}
if( startPosition < 0 ) {
throw new IllegalArgumentException
("startPosition cannot be negative");
}
Query delegate = getQueryDelegate();
delegate.setFirstResult(startPosition);
SetterData setterData = SetterData.createFirstResult(startPosition);
setterInvocations.add(setterData);
} finally {
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryEnd();
}
}
return this;
|
public javax.persistence.Query | setFlushMode(javax.persistence.FlushModeType flushMode)
Agent callFlowAgent = Switch.getSwitch().getCallFlowAgent();
try {
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryStart(EntityManagerQueryMethod.SET_FLUSH_MODE);
}
Query delegate = getQueryDelegate();
delegate.setFlushMode(flushMode);
SetterData setterData = SetterData.createFlushMode(flushMode);
setterInvocations.add(setterData);
} finally {
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryEnd();
}
}
return this;
|
public javax.persistence.Query | setHint(java.lang.String hintName, java.lang.Object value)
Agent callFlowAgent = Switch.getSwitch().getCallFlowAgent();
try {
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryStart(EntityManagerQueryMethod.SET_HINT);
}
Query delegate = getQueryDelegate();
delegate.setHint(hintName, value);
SetterData setterData = SetterData.createHint(hintName, value);
setterInvocations.add(setterData);
} finally {
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryEnd();
}
}
return this;
|
public javax.persistence.Query | setMaxResults(int maxResults)
Agent callFlowAgent = Switch.getSwitch().getCallFlowAgent();
try {
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryStart(EntityManagerQueryMethod.SET_MAX_RESULTS);
}
if( maxResults < 0 ) {
throw new IllegalArgumentException("maxResult cannot be negative");
}
Query delegate = getQueryDelegate();
delegate.setMaxResults(maxResults);
SetterData setterData = SetterData.createMaxResults(maxResults);
setterInvocations.add(setterData);
} finally {
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryEnd();
}
}
return this;
|
public javax.persistence.Query | setParameter(java.lang.String name, java.lang.Object value)
Agent callFlowAgent = Switch.getSwitch().getCallFlowAgent();
try {
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryStart(EntityManagerQueryMethod.SET_PARAMETER_STRING_OBJECT);
}
Query delegate = getQueryDelegate();
delegate.setParameter(name, value);
SetterData setterData = SetterData.createParameter(name, value);
setterInvocations.add(setterData);
} finally {
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryEnd();
}
}
return this;
|
public javax.persistence.Query | setParameter(java.lang.String name, java.util.Date value, javax.persistence.TemporalType temporalType)
Agent callFlowAgent = Switch.getSwitch().getCallFlowAgent();
try {
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryStart(EntityManagerQueryMethod.SET_PARAMETER_STRING_DATE_TEMPORAL_TYPE);
}
Query delegate = getQueryDelegate();
delegate.setParameter(name, value, temporalType);
SetterData setterData = SetterData.createParameter(name, value,
temporalType);
setterInvocations.add(setterData);
} finally {
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryEnd();
}
}
return this;
|
public javax.persistence.Query | setParameter(java.lang.String name, java.util.Calendar value, javax.persistence.TemporalType temporalType)
Agent callFlowAgent = Switch.getSwitch().getCallFlowAgent();
try {
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryStart(EntityManagerQueryMethod.SET_PARAMETER_STRING_CALENDAR_TEMPORAL_TYPE);
}
Query delegate = getQueryDelegate();
delegate.setParameter(name, value, temporalType);
SetterData setterData = SetterData.createParameter(name, value,
temporalType);
setterInvocations.add(setterData);
} finally {
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryEnd();
}
}
return this;
|
public javax.persistence.Query | setParameter(int position, java.lang.Object value)
Agent callFlowAgent = Switch.getSwitch().getCallFlowAgent();
try {
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryStart(EntityManagerQueryMethod.SET_PARAMETER_INT_OBJECT);
}
Query delegate = getQueryDelegate();
delegate.setParameter(position, value);
SetterData setterData = SetterData.createParameter(position, value);
setterInvocations.add(setterData);
} finally {
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryEnd();
}
}
return this;
|
public javax.persistence.Query | setParameter(int position, java.util.Date value, javax.persistence.TemporalType temporalType)
Agent callFlowAgent = Switch.getSwitch().getCallFlowAgent();
try {
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryStart(EntityManagerQueryMethod.SET_PARAMETER_INT_DATE_TEMPORAL_TYPE);
}
Query delegate = getQueryDelegate();
delegate.setParameter(position, value, temporalType);
SetterData setterData = SetterData.createParameter(position, value,
temporalType);
setterInvocations.add(setterData);
} finally {
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryEnd();
}
}
return this;
|
public javax.persistence.Query | setParameter(int position, java.util.Calendar value, javax.persistence.TemporalType temporalType)
Agent callFlowAgent = Switch.getSwitch().getCallFlowAgent();
try {
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryStart(EntityManagerQueryMethod.SET_PARAMETER_INT_CALENDAR_TEMPORAL_TYPE);
}
Query delegate = getQueryDelegate();
delegate.setParameter(position, value, temporalType);
SetterData setterData = SetterData.createParameter(position, value,
temporalType);
setterInvocations.add(setterData);
} finally {
if(callFlowAgent.isEnabled()) {
callFlowAgent.entityManagerQueryEnd();
}
}
return this;
|