| org.apache.openjpa.persistence.test.PersistenceTestCase org.apache.openjpa.persistence.test.SingleEMFTestCase org.apache.openjpa.persistence.test.SingleEMTestCase
All known Subclasses: org.apache.openjpa.persistence.relations.TestHandlerToRelationMaps, org.apache.openjpa.persistence.query.TestSubstring, org.apache.openjpa.persistence.relations.TestBulkUpdatesAndEmbeddedFields, org.apache.openjpa.persistence.query.TestDistinctQueries, org.apache.openjpa.persistence.lifecycle.TestPessimisticPNonTransToPDirty, org.apache.openjpa.enhance.TestUnenhancedCompoundPK, org.apache.openjpa.persistence.models.company.CompanyModelTest, org.apache.openjpa.persistence.query.GroupingTestCase, org.apache.openjpa.persistence.query.TestDataStoreActions, org.apache.openjpa.persistence.simple.TestEntityManagerMerge, org.apache.openjpa.persistence.simple.TestEntityManagerClear, org.apache.openjpa.persistence.query.TestMethodQLQuery, org.apache.openjpa.persistence.fields.TestEnumsInJPQL, org.apache.openjpa.enhance.TestUnenhancedCompoundPKSubclass, org.apache.openjpa.jdbc.meta.TestMappingToolTemporal, org.apache.openjpa.persistence.fields.TestEnumQueryConstructor, org.apache.openjpa.persistence.query.TestJPQLWithoutIdentificationVariable, org.apache.openjpa.jdbc.meta.TestCalendarField, org.apache.openjpa.persistence.relations.TestHandlerToHandlerMaps, org.apache.openjpa.persistence.xml.TestSimpleXmlEntity, org.apache.openjpa.persistence.simple.TestEntityManagerMethodsThrowAfterClose, org.apache.openjpa.persistence.lifecycle.TestMergeAndPersistWithManagedRelation, org.apache.openjpa.persistence.relations.TestHandlerCollections, org.apache.openjpa.persistence.fields.TestEnumSets, org.apache.openjpa.enhance.TestUnenhancedOneToMany, org.apache.openjpa.persistence.relations.TestRelationToRelationMaps, org.apache.openjpa.persistence.relations.TestRelationToHandlerMaps,
SingleEMTestCase | abstract public class SingleEMTestCase extends SingleEMFTestCase (Code) | | A base test case that can be used to easily test scenarios where there
is only a single EntityManager at any given time.
author: Marc Prud'hommeaux |
Method Summary | |
protected boolean | begin() Start a new transaction if there isn't currently one active. | protected boolean | close() Closes the current EntityManager if it is open. | protected boolean | commit() Commit the current transaction, if it is active. | protected List<E> | find(Class<E> c, String q, Object... params) Returns a list of all instances of the specific class in the database. | protected List<E> | find(Class<E> c) Returns a list of all instances of the specific class in the database. | protected void | persist(Object... obs) Persist all of the instances. | protected OpenJPAQuery | query(String str) Creates a query in the current EntityManager with the specified string. | protected OpenJPAQuery | query(Class c, String str, Object... params) Create a query against the specified class, which will be aliased
as "x". | protected void | remove(Object... obs) Delete all of the instances. | protected void | reset() Clear the current EntityManager and re-initialize it. | protected boolean | rollback() Rollback the current transaction, if it is active. | public void | setUp() | public void | setUp(Object... props) | public void | tearDown() |
begin | protected boolean begin()(Code) | | Start a new transaction if there isn't currently one active.
true if a transaction was started, false if one already existed |
close | protected boolean close()(Code) | | Closes the current EntityManager if it is open.
false if the EntityManager was already closed. |
commit | protected boolean commit()(Code) | | Commit the current transaction, if it is active.
true if the transaction was committed |
find | protected List<E> find(Class<E> c)(Code) | | Returns a list of all instances of the specific class in the database.
|
persist | protected void persist(Object... obs)(Code) | | Persist all of the instances.
If no transaction is running, then one will be started and committed.
Otherwise, the operation will take place in the current transaction.
|
query | protected OpenJPAQuery query(String str)(Code) | | Creates a query in the current EntityManager with the specified string.
|
query | protected OpenJPAQuery query(Class c, String str, Object... params)(Code) | | Create a query against the specified class, which will be aliased
as "x". For example, query(Person.class, "where x.age = 21") will
create the query "select x from Person x where x.age = 21".
Parameters: c - the class to query against Parameters: str - the query suffix Parameters: params - the parameters, if any the Query object |
remove | protected void remove(Object... obs)(Code) | | Delete all of the instances.
If no transaction is running, then one will be started and committed.
Otherwise, the operation will take place in the current transaction.
|
reset | protected void reset()(Code) | | Clear the current EntityManager and re-initialize it.
|
rollback | protected boolean rollback()(Code) | | Rollback the current transaction, if it is active.
true if the transaction was rolled back |
setUp | public void setUp()(Code) | | |
|
|