Package org.conical.common.bbl.jpa
Class DbWorker<T extends DataManager>
java.lang.Object
org.conical.common.bbl.jpa.DbWorker<T>
- Type Parameters:
T
- An implementation of DataManager (likely a subclass of JpaDataManager)
Performs database tasks using a given the operations available on
the passed DataManager. Typical usage is to subclass a child of DbWorker
inline and perform the required operations inside an overridden doDbTasks
method. For example, if you have:
interface AppDataManager extends DataManager
class AppDataManagerImpl implements AppDataManager extends JpaDataManager
class AppDbWorker extends DbWorker<AppDataManager>
new AppDbWorker() { public void doDbTasks(AppDataManager dataMgr) { // perform desired database operations using your custom DataManager } }.doWork();
- Author:
- rdoherty
-
Constructor Details
-
DbWorker
public DbWorker()
-
-
Method Details
-
doWork
Performs work defined in doDbTasks. What operations are performed are implementation dependent.- Throws:
Exception
- if an error occurs
-
getDataManager
Returns an instance of the subclass's implementation of DataManager- Returns:
- DataManager instance
-
doDbTasks
Must be overridden. Performs desired database operations.- Parameters:
dataManager
- DataManager subclass that can perform desired operations
-