public class OrmDaoHelper<T,ID> extends Object
| Constructor and Description |
|---|
OrmDaoHelper(PersistenceDao<T,ID> entityDao) |
| Modifier and Type | Method and Description |
|---|---|
int |
create(Object object)
Persist an object for the first time.
|
int |
delete(Object object)
Delete the database row corresponding to the id from the data parameter.
|
boolean |
entityExists(Object object)
Returns true if an object exists that matches this ID otherwise false.
|
ID |
extractId(Object object)
Returns the ID from the data parameter passed in.
|
T |
queryForId(Object primaryKey)
Retrieves an object associated with a specific ID.
|
T |
queryForSameId(Object object)
Query for a data item in the table that has the same id as the data parameter.
|
int |
refresh(Object object)
Does a query for the data parameter's id and copies in each of the field values from the database to refresh the
data parameter.
|
int |
update(Object object)
Store the fields from an object to the database row corresponding to the id from the data parameter.
|
public OrmDaoHelper(PersistenceDao<T,ID> entityDao)
public int create(Object object)
object - - the entity to be persistedpublic T queryForId(Object primaryKey)
primaryKey - Identifier that matches a specific row in the database to find and return.RuntimeException - on any SQL problems or if more than 1 item with the id are found in the database.public T queryForSameId(Object object)
public ID extractId(Object object)
public boolean entityExists(Object object)
public int update(Object object)
NOTE: This will not save changes made to foreign objects or to foreign collections.
object - The data item that we are updating in the database.RuntimeException - on any SQL problems.IllegalArgumentException - If there is only an ID field in the object.public int refresh(Object object)
object - The data item that we are refreshing with fields from the database.RuntimeException - on any SQL problems or if the data item is not found in the table
or if more than 1 item is found with data's id.public int delete(Object object)
object - The data item that we are deleting from the database.RuntimeException - on any SQL problems.This documentation is licensed by Andrew Bowley under the GPLv3 License.