public abstract class JDBCEntityManager extends java.lang.Object implements DistributableEntityManager
Modifier and Type | Field and Description |
---|---|
protected DDBSEntityManager<DDBSEntity<DDBSEntityProperty>> |
ddbsEntityManager
DDBS Entity manager
|
protected JDBCConditionConverter |
jdbcConditionConverter
JDBC Condition converter
|
protected JDBCConnector |
jdbcConnector
JDBC connector
|
protected JDBCPreparedStatementManager |
jdbcPreparedStatementManager
JDBC Prepared Statement Manager
|
Constructor and Description |
---|
JDBCEntityManager(JDBCConnector jdbcConnector)
JDBC Entity manager with a single connection
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(IEntity objectToAdd)
Add an element to a data source
|
void |
close()
Close the data source connection
|
void |
commit(DDBSTransaction transaction)
Commit a transaction
|
protected <T extends IEntity> |
conversionResultSet(java.sql.ResultSet results,
T myObject) |
boolean |
createEntity(IEntity objectToCreate)
Create the structure of the entity
|
boolean |
delete(IEntity objectToDelete)
Delete an object in a data source
|
DDBSTransaction |
executeTransaction(DDBSTransaction transaction)
Execute a list of actions
|
protected java.lang.String |
getDeleteSQLString(DDBSEntity<DDBSEntityProperty> ddbsEntity)
Create Delete SQL Query
|
protected java.lang.String |
getInsertSQLString(DDBSEntity<DDBSEntityProperty> ddbsEntity)
Create Insert SQL Query
|
protected java.lang.String |
getUpdateSQLString(DDBSEntity<DDBSEntityProperty> ddbsEntity)
Create Update SQL Query
|
boolean |
isOpen()
Check if the connection is open
|
<T extends IEntity> |
listAll(T object,
Conditions conditions,
OrderBy orderBy)
List all entities of a specific object
|
<T extends IEntity> |
listAllWithQueryString(T object,
java.lang.String conditionQueryString,
OrderBy orderBy)
List all entities of a specific object
|
<T extends IEntity> |
loadArray(T objectToLoad,
java.lang.String field,
OrderBy orderBy)
Load a property of the object corresponding to an array
|
void |
open()
Open the data source connection
|
<T extends IEntity> |
read(T object)
Read details about an object
|
<T extends IEntity> |
readLastElement(T object)
Read the last element added of a table or a type of data source (Id annotation has to be used)
|
void |
rollback(DDBSTransaction transaction)
Rollback the transaction
|
void |
setAutoCommit(boolean isAutoCommit)
Set the auto-commit for the data source
|
boolean |
update(IEntity objectToUpdate)
Update an element in a data source
|
protected JDBCConnector jdbcConnector
protected JDBCPreparedStatementManager jdbcPreparedStatementManager
protected DDBSEntityManager<DDBSEntity<DDBSEntityProperty>> ddbsEntityManager
protected JDBCConditionConverter jdbcConditionConverter
public JDBCEntityManager(JDBCConnector jdbcConnector)
jdbcConnector
- JDBC Connectorpublic boolean isOpen() throws DDBSToolkitException
DistributableEntityManager
isOpen
in interface DistributableEntityManager
DDBSToolkitException
- Error to check the state of the connectionpublic void open() throws DDBSToolkitException
DistributableEntityManager
open
in interface DistributableEntityManager
DDBSToolkitException
- : Error to open the connectionpublic void close() throws DDBSToolkitException
DistributableEntityManager
close
in interface DistributableEntityManager
DDBSToolkitException
- : Error to close the connectionpublic void setAutoCommit(boolean isAutoCommit) throws DDBSToolkitException
DistributableEntityManager
setAutoCommit
in interface DistributableEntityManager
isAutoCommit
- Boolean returning if there is auto-commit in the transactionDDBSToolkitException
- : Error to set the auto-commit valuepublic void commit(DDBSTransaction transaction) throws DDBSToolkitException
DistributableEntityManager
commit
in interface DistributableEntityManager
transaction
- TransactionDDBSToolkitException
- : Error to commit the transactionpublic void rollback(DDBSTransaction transaction) throws DDBSToolkitException
DistributableEntityManager
rollback
in interface DistributableEntityManager
transaction
- TransactionDDBSToolkitException
- : Error to rollback the connectionpublic DDBSTransaction executeTransaction(DDBSTransaction transaction) throws DDBSToolkitException
DistributableEntityManager
executeTransaction
in interface DistributableEntityManager
transaction
- List of commandsDDBSToolkitException
- : Error to execute the transactionpublic <T extends IEntity> java.util.List<T> listAll(T object, Conditions conditions, OrderBy orderBy) throws DDBSToolkitException
DistributableEntityManager
listAll
in interface DistributableEntityManager
T
- IEntity extended entityobject
- Object to searchconditions
- Conditions to filter the resultsorderBy
- Order By ObjectDDBSToolkitException
- Error during the processpublic <T extends IEntity> java.util.List<T> listAllWithQueryString(T object, java.lang.String conditionQueryString, OrderBy orderBy) throws DDBSToolkitException
DistributableEntityManager
listAllWithQueryString
in interface DistributableEntityManager
T
- IEntity extended entityobject
- Object to searchconditionQueryString
- Condition query string to filter the resultsorderBy
- Order By ObjectDDBSToolkitException
- Error during the processpublic <T extends IEntity> T read(T object) throws DDBSToolkitException
DistributableEntityManager
read
in interface DistributableEntityManager
T
- IEntity extended entityobject
- object to readDDBSToolkitException
- Error during readingpublic <T extends IEntity> T readLastElement(T object) throws DDBSToolkitException
DistributableEntityManager
readLastElement
in interface DistributableEntityManager
T
- IEntity extended entityobject
- object to readDDBSToolkitException
- Error during readingprotected java.lang.String getInsertSQLString(DDBSEntity<DDBSEntityProperty> ddbsEntity)
ddbsEntity
- DDBSEntitypublic boolean add(IEntity objectToAdd) throws DDBSToolkitException
UpdatableEntityManager
add
in interface UpdatableEntityManager
objectToAdd
- Object to add in a data sourceDDBSToolkitException
- Problem during operationprotected java.lang.String getUpdateSQLString(DDBSEntity<DDBSEntityProperty> ddbsEntity)
ddbsEntity
- DDBSEntitypublic boolean update(IEntity objectToUpdate) throws DDBSToolkitException
UpdatableEntityManager
update
in interface UpdatableEntityManager
objectToUpdate
- Object to updateDDBSToolkitException
- Problem during operationprotected java.lang.String getDeleteSQLString(DDBSEntity<DDBSEntityProperty> ddbsEntity)
ddbsEntity
- DDBSEntitypublic boolean delete(IEntity objectToDelete) throws DDBSToolkitException
UpdatableEntityManager
delete
in interface UpdatableEntityManager
objectToDelete
- Object to deleteDDBSToolkitException
- Problem during operationpublic <T extends IEntity> T loadArray(T objectToLoad, java.lang.String field, OrderBy orderBy) throws DDBSToolkitException
DistributableEntityManager
loadArray
in interface DistributableEntityManager
T
- IEntity extended entityobjectToLoad
- Object to loadfield
- Array to loadorderBy
- Order By ObjectDDBSToolkitException
- Problem during operationpublic boolean createEntity(IEntity objectToCreate) throws DDBSToolkitException
UpdatableEntityManager
createEntity
in interface UpdatableEntityManager
objectToCreate
- Object to createDDBSToolkitException
- Problem during operationprotected <T extends IEntity> java.util.List<T> conversionResultSet(java.sql.ResultSet results, T myObject) throws DDBSToolkitException
DDBSToolkitException