Constructors Summary |
---|
public EntityManagerImpl(String sessionName, boolean propagatePersistenceContext, boolean extended)Constructor returns an EntityManager assigned to the a particular ServerSession.
super(sessionName, propagatePersistenceContext, extended);
flushMode = FlushModeType.AUTO;
|
public EntityManagerImpl(ServerSession serverSession, boolean propagatePersistenceContext, boolean extended)Constructor called from the EntityManagerFactory to create an EntityManager
this(serverSession, null, propagatePersistenceContext, extended);
|
public EntityManagerImpl(ServerSession serverSession, Map properties, boolean propagePersistenceContext, boolean extended)Constructor called from the EntityManagerFactory to create an EntityManager
super(serverSession, properties, propagePersistenceContext, extended);
flushMode = FlushModeType.AUTO;
|
public EntityManagerImpl(EntityManagerFactoryImpl factory, Map properties, boolean propagePersistenceContext, boolean extended)Constructor called from the EntityManagerFactory to create an EntityManager
super(factory, properties, propagePersistenceContext, extended);
flushMode = FlushModeType.AUTO;
|
Methods Summary |
---|
public javax.persistence.Query | createNamedQuery(java.lang.String name)Create an instance of Query for executing a
named query (in EJBQL or native SQL).
try {
verifyOpen();
return new EJBQueryImpl(name, this, true);
} catch (RuntimeException e) {
this.transaction.setRollbackOnlyInternal();
throw e;
}
|
public javax.persistence.Query | createNativeQuery(java.lang.String sqlString)Create an instance of Query for executing
a native SQL query.
try {
verifyOpen();
return new EJBQueryImpl( EJBQueryImpl.buildSQLDatabaseQuery( sqlString, false), this );
} catch (RuntimeException e) {
this.transaction.setRollbackOnlyInternal();
throw e;
}
|
public javax.persistence.Query | createNativeQuery(java.lang.String sqlString, java.lang.Class resultType)This method is used to create a query using SQL. The class, must be the expected
return type.
try {
verifyOpen();
DatabaseQuery query = createNativeQueryInternal(sqlString, resultType);
return new EJBQueryImpl(query, this);
} catch (RuntimeException e) {
this.transaction.setRollbackOnlyInternal();
throw e;
}
|
public javax.persistence.Query | createNativeQuery(java.lang.String sqlString, java.lang.String resultSetMapping)Create an instance of Query for executing
a native SQL query.
try {
verifyOpen();
ResultSetMappingQuery query = new ResultSetMappingQuery();
query.setSQLResultSetMappingName(resultSetMapping);
query.setSQLString(sqlString);
query.setIsUserDefined(true);
return new EJBQueryImpl(query, this);
} catch (RuntimeException e) {
this.transaction.setRollbackOnlyInternal();
throw e;
}
|
public javax.persistence.Query | createQuery(oracle.toplink.essentials.expressions.Expression expression, java.lang.Class resultType)This method is used to create a query using a Toplink Expression and the return type.
try {
verifyOpen();
DatabaseQuery query = createQueryInternal(expression, resultType);
return new EJBQueryImpl(query, this);
} catch (RuntimeException e) {
this.transaction.setRollbackOnlyInternal();
throw e;
}
|
public javax.persistence.Query | createQuery(java.lang.String ejbqlString)Create an instance of Query for executing an
EJBQL query.
try {
verifyOpen();
EJBQueryImpl ejbqImpl;
try
{
ejbqImpl = new EJBQueryImpl(ejbqlString, this);
}
catch(EJBQLException ex)
{
throw new IllegalArgumentException(ExceptionLocalization.buildMessage("wrap_ejbql_exception"), ex);
}
return ejbqImpl;
} catch (RuntimeException e) {
this.transaction.setRollbackOnlyInternal();
throw e;
}
|
public T | find(java.lang.Class entityClass, java.lang.Object primaryKey)Find by primary key.
try {
verifyOpen();
return (T) findInternal(entityClass, primaryKey);
} catch (RuntimeException e) {
this.transaction.setRollbackOnlyInternal();
throw e;
}
|
public javax.persistence.FlushModeType | getFlushMode()Get the flush mode that applies to all objects contained
in the persistence context.
try {
verifyOpen();
return flushMode;
} catch (RuntimeException e) {
this.transaction.setRollbackOnlyInternal();
throw e;
}
|
public T | getReference(java.lang.Class entityClass, java.lang.Object primaryKey)Get an instance, whose state may be lazily fetched.
If the requested instance does not exist in the database,
throws EntityNotFoundException when the instance state is first accessed.
(The container is permitted to throw EntityNotFoundException when get is called.)
The application should not expect that the instance state will
be available upon detachment, unless it was accessed by the
application while the entity manager was open.
try {
verifyOpen();
Object returnValue = findInternal(entityClass, primaryKey);
if (returnValue ==null){
Object[] o = {primaryKey};
String message = ExceptionLocalization.buildMessage("no_entities_retrieved_for_get_reference", o);
throw new javax.persistence.EntityNotFoundException(message);
}
return (T)returnValue;
} catch (RuntimeException e) {
this.transaction.setRollbackOnlyInternal();
throw e;
}
|
public javax.persistence.EntityTransaction | getTransaction()Returns the resource-level transaction object.
The EntityTransaction instance may be used serially to
begin and commit multiple transactions.
try {
return ((TransactionWrapper)transaction).getTransaction();
} catch (RuntimeException e) {
this.transaction.setRollbackOnlyInternal();
throw e;
}
|
public boolean | isFlushModeAUTO()Internal method. Indicates whether flushMode is AUTO.
return flushMode == FlushModeType.AUTO;
|
public T | merge(T entity)Merge the state of the given entity into the
current persistence context, using the unqualified
class name as the entity name.
try{
verifyOpen();
return (T) mergeInternal(entity);
}catch (RuntimeException e){
this.transaction.setRollbackOnlyInternal();
throw e;
}
|
protected void | setEntityTransactionWrapper()
transaction = new EntityTransactionWrapper(this);
|
public void | setFlushMode(javax.persistence.FlushModeType flushMode)Set the flush mode that applies to all objects contained
in the persistence context.
try {
verifyOpen();
this.flushMode = flushMode;
} catch (RuntimeException e) {
this.transaction.setRollbackOnlyInternal();
throw e;
}
|
protected void | setJTATransactionWrapper()
transaction = new JTATransactionWrapper(this);
|