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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidTests more deeply theEntityManager.persist(Object)method by inserting a newAbstractLightObjectinto the database.voidcleanDB()Cleans the database and restore beginning data to start on a well known statestatic voidcloseAll()static voidvoidTests quickly theEntityManager.persist(Object)method by inserting a newAbstractLightObjectinto the database.protected abstract TcreateObject(String display)voidLoad 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 Stringprotected abstract intprotected abstract org.dbunit.dataset.IDataSetprotected abstract StringvoidvoidTests the loading by id of aAbstractLightObjectinjected into the database.voidTests the loading by id of aAbstractLightObjectinjected into the database.voidvoidCloses 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 newAbstractLightObjectinto the database.- Throws:
Exception
-
loadLightObjectById
Tests the loading by id of aAbstractLightObjectinjected into the database.- Throws:
Exception
-
loadLightObjectByDisplay
Tests the loading by id of aAbstractLightObjectinjected into the database.- Throws:
Exception
-
addAndRemoveLightObjects
Tests more deeply theEntityManager.persist(Object)method by inserting a newAbstractLightObjectinto 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
-