
public abstract class AbstractDbDataDao<E> extends AbstractDbData
AbstractDbData.UpdatedInfo| Modifier and Type | Field and Description |
|---|---|
static String |
JSON_MODEL |
protected E |
pojo |
protected static String |
SHOULD_NOT_BE_CALLED |
allFields, dbSession, isSaved, otherFields, primaryKey| Modifier | Constructor and Description |
|---|---|
protected |
AbstractDbDataDao()
Abstract constructor
|
| Modifier and Type | Method and Description |
|---|---|
String |
asJson() |
abstract void |
changeUpdatedInfo(AbstractDbData.UpdatedInfo info)
Change UpdatedInfo status
|
protected abstract void |
checkValues() |
void |
delete()
Delete object from table
|
boolean |
exist()
Test the existence of the current object
|
protected abstract AbstractDAO<E> |
getDao(boolean isCacheable) |
protected String |
getInsertAllValues()
|
com.fasterxml.jackson.databind.node.ObjectNode |
getJson()
Create the equivalent object in Json (no database access)
|
protected abstract String |
getPrimaryField() |
protected abstract String |
getPrimaryKey() |
protected String |
getSelectAllFields()
|
protected abstract String |
getTable() |
protected String |
getUpdateAllFields()
|
protected void |
getValues(DbPreparedStatement preparedStatement,
DbValue[] values)
|
protected String |
getWherePrimaryKey()
|
protected void |
initObject()
To setup primaryKey, otherFields, allFields.
|
void |
insert()
Insert object into table
|
void |
select()
Select object from table
|
protected void |
setFromArray()
|
void |
setFromJson(com.fasterxml.jackson.databind.node.ObjectNode node,
boolean ignorePrimaryKey)
Set the values from the Json node to the current object (no database
access)
|
protected abstract void |
setFromJson(String field,
com.fasterxml.jackson.databind.JsonNode value) |
protected void |
setPrimaryKey()
|
protected void |
setToArray()
|
String |
toJson() |
void |
update()
Update object to table
|
static void |
validateLength(byte[]... values)
Validate Byte array max length
|
static void |
validateLength(int type,
String... values)
Validate String max length
|
getAllFields, getTrueValue, setTrueValue, setValuespublic static final String JSON_MODEL
protected static final String SHOULD_NOT_BE_CALLED
protected E pojo
public static void validateLength(byte[]... values)
throws WaarpDatabaseSqlException
values - the values to check against Types.VARBINARYWaarpDatabaseSqlException - if length is not acceptablepublic static void validateLength(int type,
String... values)
throws WaarpDatabaseSqlException
type - between Types.VARCHAR, NVARCHAR, LONGVARCHARvalues - the values to check against same typeWaarpDatabaseSqlException - if length is not acceptableprotected abstract String getTable()
getTable in class AbstractDbDataprotected abstract void checkValues()
throws WaarpDatabaseSqlException
WaarpDatabaseSqlExceptionprotected abstract AbstractDAO<E> getDao(boolean isCacheable) throws DAOConnectionException
DAOConnectionExceptionprotected abstract String getPrimaryKey()
protected abstract String getPrimaryField()
public abstract void changeUpdatedInfo(AbstractDbData.UpdatedInfo info)
changeUpdatedInfo in class AbstractDbDatainfo - public boolean exist()
throws WaarpDatabaseException
exist in class AbstractDbDataWaarpDatabaseExceptionpublic void select()
throws WaarpDatabaseException
select in class AbstractDbDataWaarpDatabaseExceptionpublic void insert()
throws WaarpDatabaseException
insert in class AbstractDbDataWaarpDatabaseExceptionpublic void update()
throws WaarpDatabaseException
update in class AbstractDbDataWaarpDatabaseExceptionpublic void delete()
throws WaarpDatabaseException
delete in class AbstractDbDataWaarpDatabaseExceptionpublic final String asJson()
asJson in class AbstractDbDatapublic String toJson()
public com.fasterxml.jackson.databind.node.ObjectNode getJson()
getJson in class AbstractDbDataprotected abstract void setFromJson(String field, com.fasterxml.jackson.databind.JsonNode value) throws WaarpDatabaseSqlException
WaarpDatabaseSqlExceptionpublic void setFromJson(com.fasterxml.jackson.databind.node.ObjectNode node,
boolean ignorePrimaryKey)
throws WaarpDatabaseSqlException
setFromJson in class AbstractDbDatanode - ignorePrimaryKey - True will ignore primaryKey from JsonWaarpDatabaseSqlExceptionprotected void initObject()
AbstractDbDatainitObject in class AbstractDbDataprotected String getWherePrimaryKey()
getWherePrimaryKey in class AbstractDbDataprotected void setPrimaryKey()
setPrimaryKey in class AbstractDbDataprotected String getSelectAllFields()
getSelectAllFields in class AbstractDbDataprotected String getInsertAllValues()
getInsertAllValues in class AbstractDbDataprotected String getUpdateAllFields()
getUpdateAllFields in class AbstractDbDataprotected void setToArray()
setToArray in class AbstractDbDataprotected void setFromArray()
setFromArray in class AbstractDbDataprotected void getValues(DbPreparedStatement preparedStatement, DbValue[] values)
getValues in class AbstractDbDataCopyright © 2009–2022 Waarp. All rights reserved.