Package be.gaudry.dao.jpa.test
Class JpaGenericLightObjectTest<T extends ILightObject>
java.lang.Object
be.gaudry.dao.jpa.test.JpaGenericLightObjectTest<T>
- Type Parameters:
T
-
- Direct Known Subclasses:
JpaLightObjectTest
,JpaPersonExtTest
,JpaPersonTest
- Since:
- 1.0 Oct 6, 2010, 1.0
- Version:
- %I%, %G%
- Author:
- Steph GAUDRY
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Tests more deeply theEntityManager.persist(Object)
method by inserting a newAbstractLightObject
into the database.void
cleanDB()
Cleans the database and restore beginning data to start on a well known statestatic void
closeAll()
static void
void
Tests quickly theEntityManager.persist(Object)
method by inserting a newAbstractLightObject
into the database.protected abstract T
createObject(String display)
void
Load twice a same DB object into 2 Java Objects, modifies one, checks 2nd has been updated, and load a third Java Object to check if the modifications has been persistedprotected abstract String
protected abstract int
protected abstract org.dbunit.dataset.IDataSet
protected abstract String
void
void
Tests the loading by id of aAbstractLightObject
injected into the database.void
Tests the loading by id of aAbstractLightObject
injected into the database.void
void
Closes and creates a new EntityManager to detach objects from the context
-
Field Details
-
em
protected static javax.persistence.EntityManager em -
tx
protected javax.persistence.EntityTransaction tx -
MSGLINE
-
tableName
Name of the table for the T class, used into native SQL. Default value is class simple name (like for the JPQL queries).
-
-
Constructor Details
-
JpaGenericLightObjectTest
-
-
Method Details
-
getDataSet
- Throws:
Exception
-
getEntityManagerName
-
getCheckedItemDisplay
-
getCheckedItemId
protected abstract int getCheckedItemId() -
createObject
-
closeAll
- Throws:
SQLException
-
closeEntityManager
public static void closeEntityManager() -
resetEntityManager
Closes and creates a new EntityManager to detach objects from the context- Throws:
Exception
-
initTransaction
public final void initTransaction() -
cleanDB
Cleans the database and restore beginning data to start on a well known state- Throws:
Exception
-
createLightObject
Tests quickly theEntityManager.persist(Object)
method by inserting a newAbstractLightObject
into the database.- Throws:
Exception
-
loadLightObjectById
Tests the loading by id of aAbstractLightObject
injected into the database.- Throws:
Exception
-
loadLightObjectByDisplay
Tests the loading by id of aAbstractLightObject
injected into the database.- Throws:
Exception
-
addAndRemoveLightObjects
Tests more deeply theEntityManager.persist(Object)
method by inserting a newAbstractLightObject
into the database. Tests also theEntityManager.remove(Object)
method.- Throws:
Exception
-
modifyLightObject
- Throws:
Exception
-
crossModification
Load twice a same DB object into 2 Java Objects, modifies one, checks 2nd has been updated, and load a third Java Object to check if the modifications has been persisted- Throws:
Exception
-