|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.dao.support.DaoSupport
org.springframework.orm.ibatis.support.SqlMapClientDaoSupport
info.joseluismartin.dao.ibatis.IBatisDao<T,PK>
public class IBatisDao<T,PK extends Serializable>
Dao implementation that use iBatis 2.x as ORM framework
| Field Summary |
|---|
| Fields inherited from class org.springframework.dao.support.DaoSupport |
|---|
logger |
| Constructor Summary | |
|---|---|
IBatisDao()
|
|
| Method Summary | ||
|---|---|---|
void |
delete(T entity)
Delete an entity |
|
void |
deleteById(PK id)
Delete an object by primary key |
|
boolean |
exists(PK id)
Checks for existence of an object of type T using the id arg. |
|
List<T> |
findByNamedQuery(String queryName,
Map<String,Object> queryParams)
Find a list of records by using a named query |
|
T |
get(PK id)
Find object by id |
|
|
get(PK id,
Class<E> clazz)
|
|
List<T> |
getAll()
Get all models |
|
|
getAll(Class<E> clazz)
|
|
List<T> |
getAllDistinct()
|
|
protected String |
getDeleteQuery()
Gets name of delete query in SqlMaps |
|
Class<T> |
getEntityClass()
|
|
protected String |
getEntityName()
Return de entity name for build query names |
|
protected String |
getInsertQuery()
Gets name of insert query in SqlMaps |
|
List<Serializable> |
getKeys(Page<T> page)
Gets a List with keys of page |
|
protected String |
getNewIdQuery()
Gets name of new id query in SqlMaps |
|
Page<T> |
getPage(Page<T> page)
Fill and return a page of data |
|
protected PK |
getPrimaryKey(T entity)
Get the PK from entity |
|
protected String |
getPrimaryKeyPropertyName()
Gets the PK property name |
|
protected String |
getUpdateQuery()
Gets name of update query in SqlMaps |
|
protected String |
getValidateDuplicateQuery()
Gets name of "validate duplicates" query in SqlMaps |
|
T |
initialize(T entity)
Initalize entity at default depth |
|
T |
initialize(T entity,
int depth)
Initalize entity |
|
PK |
insert(T entity)
|
|
void |
remove(PK id)
|
|
T |
save(T entity)
Save or update an object |
|
void |
setEntityClass(Class<T> entityClass)
|
|
void |
update(T entity)
|
|
| Methods inherited from class org.springframework.orm.ibatis.support.SqlMapClientDaoSupport |
|---|
checkDaoConfig, getDataSource, getSqlMapClient, getSqlMapClientTemplate, setDataSource, setSqlMapClient, setSqlMapClientTemplate |
| Methods inherited from class org.springframework.dao.support.DaoSupport |
|---|
afterPropertiesSet, initDao |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public IBatisDao()
| Method Detail |
|---|
public Page<T> getPage(Page<T> page)
getPage in interface PageableDataSource<T>public T save(T entity)
Dao
save in interface Dao<T,PK extends Serializable>entity - the object to save
public PK insert(T entity)
public void update(T entity)
protected PK getPrimaryKey(T entity)
entity -
protected String getPrimaryKeyPropertyName()
public void delete(T entity)
Dao
delete in interface Dao<T,PK extends Serializable>entity - to deletepublic void deleteById(PK id)
Dao
deleteById in interface Dao<T,PK extends Serializable>id - the primary key
public T get(PK id)
throws org.springframework.dao.DataAccessException
Dao
get in interface Dao<T,PK extends Serializable>id - the identifier (primary key) of the object to get
org.springframework.dao.DataAccessException
public List<T> getAll()
throws org.springframework.dao.DataAccessException
Dao
getAll in interface Dao<T,PK extends Serializable>org.springframework.dao.DataAccessExceptionprotected String getInsertQuery()
protected String getValidateDuplicateQuery()
protected String getUpdateQuery()
protected String getDeleteQuery()
protected String getNewIdQuery()
protected String getEntityName()
public Class<T> getEntityClass()
public void setEntityClass(Class<T> entityClass)
entityClass - the entityClass to setpublic boolean exists(PK id)
Dao
exists in interface Dao<T,PK extends Serializable>id - the id of the entity
public List<T> findByNamedQuery(String queryName,
Map<String,Object> queryParams)
Dao
findByNamedQuery in interface Dao<T,PK extends Serializable>queryName - query name of the named queryqueryParams - a map of the query names and the values
public List<T> getAllDistinct()
public void remove(PK id)
public List<Serializable> getKeys(Page<T> page)
PageableDataSource
getKeys in interface PageableDataSource<T>public T initialize(T entity)
Dao
initialize in interface Dao<T,PK extends Serializable>entity - to intialize
public T initialize(T entity,
int depth)
Dao
initialize in interface Dao<T,PK extends Serializable>entity - to intializedepth - to descend.
public <E> E get(PK id,
Class<E> clazz)
get in interface Dao<T,PK extends Serializable>public <E> List<E> getAll(Class<E> clazz)
getAll in interface Dao<T,PK extends Serializable>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||