public abstract class BaseDaoEnabled<T,ID> extends Object
Dao
on the class if it is received by a query but if you are trying to
create the class, you will need to either create it through the DAO or set the dao on it directly with
setDao(Dao)
.
NOTE: The default pattern is to use the Dao
classes to operate on your data classes. This will allow
your data classes to have their own hierarchy and isolates the database code in the Daos. However, you are free to
use this base class if you prefer this pattern.
NOTE: The internal Dao field has been marked with transient so that it won't be serialized (thanks jc). If you do de-serialize on these classes, you will need to refresh it with the Dao to get it to work again.
Constructor and Description |
---|
BaseDaoEnabled() |
Modifier and Type | Method and Description |
---|---|
int |
create()
A call through to the
Dao.create(Object) . |
int |
delete()
A call through to the
Dao.delete(Object) . |
ID |
extractId()
A call through to the
Dao.extractId(Object) . |
Dao<T,ID> |
getDao()
Return the DAO object associated with this object.
|
boolean |
objectsEqual(T other)
A call through to the
Dao.objectsEqual(Object, Object) . |
String |
objectToString()
A call through to the
Dao.objectToString(Object) . |
int |
refresh()
A call through to the
Dao.refresh(Object) . |
void |
setDao(Dao<T,ID> dao)
Set the
Dao on the object. |
int |
update()
A call through to the
Dao.update(Object) . |
int |
updateId(ID newId)
A call through to the
Dao.updateId(Object, Object) . |
public int create() throws SQLException
Dao.create(Object)
.SQLException
public int refresh() throws SQLException
Dao.refresh(Object)
.SQLException
public int update() throws SQLException
Dao.update(Object)
.SQLException
public int updateId(ID newId) throws SQLException
Dao.updateId(Object, Object)
.SQLException
public int delete() throws SQLException
Dao.delete(Object)
.SQLException
public String objectToString()
Dao.objectToString(Object)
.public ID extractId() throws SQLException
Dao.extractId(Object)
.SQLException
public boolean objectsEqual(T other) throws SQLException
Dao.objectsEqual(Object, Object)
.SQLException
public Dao<T,ID> getDao()
setDao(Dao)
has already been called.This documentation is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.