Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package springdao;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.ManyToOne;
import java.util.List;
import java.util.Map;
/**
*
* @author Kent Yeh
*/
public interface DaoRepository {
/**
* return type of handle object.
* 取回DAO物件真正對應所要處理的物件
*
* @return target object class.
*/
public Class getClazz();
/**
* build a instance of <E>.
*
* @return instance of {@link #getClazz() getClazz()}
* @throws java.lang.InstantiationException
* @throws java.lang.IllegalAccessException
*/
public E instanate() throws InstantiationException, IllegalAccessException;
/**
* Completely clear the session. Evict all loaded instances and cancel all
* pending saves, updates and deletions. Do not close open iterators or
* instances of ScrollableResults.
*/
public void clear();
/**
* Check if this instance is associated with this Session.
*
* @param entity
* @return True/False
*/
boolean contains(Object entity);
/**
* Find entity with serializable primaryKey.
* 以主鍵找尋物件
*
* @param primaryKey 主鍵
* @return entity/物件
*/
public E findByPrimaryKey(Serializable primaryKey);
/**
* Find entity with serializable id and lockMode.
*
* @param primaryKey
* @param lockMode
* @return entity/物件
*/
public E findByPrimaryKey(Serializable primaryKey, String lockMode);
public E findByPrimaryKey(Serializable primaryKey, Map properties);
public E findByPrimaryKey(Serializable primaryKey, String lockMode, Map properties);
/**
* Save entiry 儲存物件
*
* @param entity entity(物件)
* @return saved entity/儲存物件
*/
public E save(E entity);
/**
* Save multipal entities.
* 一次儲存多個物件
*
* @param entities
* @return saved entities/儲存物件
*/
public Collection save(Collection entities);
/*
* Make an instance managed and persistent.
*/
public E persist(E entity);
/**
* update entity
* 更新物件
*
* @param entity 物件
* @return merged entity/更新後的物件
*/
public E update(E entity);
/**
* update multipal entities
* 一次更新多個物件
*
* @param entities
* @return merged entities/更新後的物件
*/
public Collection update(Collection entities);
public E merge(E entity);
public Collection merge(Collection entities);
/**
* Save or update entity
* 儲存或更新物件
*
* @param entity 物件
* @return merged entity/更新後的物件
*/
public E saveOrUpdate(E entity);
/**
* Save or update multipal entities
* 一次儲存或更新多個物件
*
* @param entities
* @return merged entities/更新後的物件
*/
public Collection saveOrUpdate(Collection entities);
/**
* Delete entity by primary key.
* 藉由主鍵刪除物件
*
Notice:
* A child entity with a {@link ManyToOne @ManyToOne} reference to a
* parent entity can't be delete directed by {@link Dao @Dao} or
* {@link DaoManager @DaoManager}, It should be delete like
*
注意:
* 當子物件包含{@link ManyToOne @ManyToOne}參考到父物件時,無法直接由
* {@link Dao @Dao} or
* {@link DaoManager @DaoManager}刪除,必須以下方代碼進行子物件刪除
*
Or it can be deleted by issue a blukUpdate command instead like
*
* 或是使用以下代碼刪除
*
childDao.blukUpdate("DELETE FROM "+getEntityName()+" WHERE id=?",child.getId())
*
* @param primaryKey
*/
public void delete(Serializable primaryKey);
/**
* Delete entity with lockMode.
* 以指定的層級鎖定刪除物件
*
* @param primaryKey
* @param lockMode
*/
public void delete(Serializable primaryKey, String lockMode);
public void delete(Collection extends Serializable> primaryKeys);
public E remove(E entity);
public E remove(E entity, String lockMode);
public Collection remove(Collection entities);
/**
* Lock entity with lockMode.
* 以指定的層級鎖定物件
*
* @param entity
* @param lockMode
* @return locked entity/鎖定的物件
*/
public E lock(E entity, String lockMode);
/**
* Refresh the state of the instance from the database, overwriting changes
* made to the entity, if any.
* 重新讀取物件
*
* @param entity
* @return entity instance/物件
*/
public E refresh(E entity);
/**
* Refresh the state of the instance from the database, overwriting changes
* made to the entity, if any.
* 以指定的層級鎖定重新讀取物件
*
* @param entity
* @param lockMode
* @return entity instance/物件
*/
public E refresh(E entity, String lockMode);
public int sqlUpdate(String sql);
public int sqlUpdate(String sql, Object... parameters);
public int sqlUpdate(String sql, Map parameters);
public List sqlUpdate(List sqls);
public int bulkUpdate(String QL);
public List bulkUpdate(List QLs);
public int bulkUpdate(String QL, Object... parameters);
public int bulkUpdate(String QL, Map parameters);
/**
* returne entity name.
* 回傳ENTITY的名稱(類別名稱)
* 叫用
* {@link #getClazz() getClazz()}.{@link java.lang.Class#getName() getName()}
*
* @return 類別名稱
*/
public String getEntityName();
/**
* alias for {@link #getEntityName() getEntityName()}.
* {@link #getEntityName() getEntityName()}的別名
*
* @return 類別名稱
*/
public String $e();
/**
* Default alias of entity.
* Lowercase first character of class name.
* 取得預設查詢所使用的別名
* 實際上是等於 類別名稱的第一碼改為小寫
*
* @return alias name of target entity class
*/
public String getAliasName();
/**
* alias for {@link #getAliasName() getAliasName()}.
* {@link #getAliasName() getAliasName()}的別名
*
* @return alias name of target entity class
*/
public String $a();
/**
* return {@link #$e() $e()}+"AS"+{@link #$a() $a()}.
* 回傳{@link #$e() $e()}+"AS"+{@link #$a() $a()}的組合
*
* @return {@link #$e() $e()} AS {@link #$a() $a()}
*/
public String $ea();
/**
* Query by criteria by invoke
* {@link #findByCriteria(String ,int ,int ) findByCriteria(criteria, 0, 0)}.
* 條件查詢 會叫用{@link #findByCriteria(String ,int ,int ) findByCriteria(criteria, 0, 0)}
*
* @param qlCriteria QL 的查詢條件
* @return List of entities. 物件集合
*/
public List findByCriteria(String qlCriteria);
/**
* Query by criteria.
* QL statement will be "from " +
* {@link #getEntityName() getEntityName()} + " as " +
* {@link #getAliasName() getAliasName()} + criteria
* 條件查詢所有資料
* 實際查詢時QL會組成 "from " + {@link #getEntityName() getEntityName()} +
* " as " + {@link #getAliasName() getAliasName()} + criteria
*
* @param qlCriteria QL parameter(using ? mark) 的查詢條件(參數要用 ? )
* @param parameters paraemters(with ? mark). 參數(順序必須時應QL內的 ?)
* @return List of entities.物件集合
*/
public List findByCriteria(String qlCriteria, Object... parameters);
public List findByCriteria(String qlCriteria, Map parameters);
/**
* Query by criteria.
* QL statement will be "from " +
* {@link #getEntityName() getEntityName()} + " as " +
* {@link #getAliasName() getAliasName()} + criteria
* 條件查詢所有資料
* 實際查詢時QL會組成 "from " + {@link #getEntityName() getEntityName()} +
* " as " + {@link #getAliasName() getAliasName()} + criteria
*
* @param qlCriteria QL (? mark means parameter).的查詢條件(參數要用 ? )
* @param startPageNo start page no.起始頁數
* @param pageSize page size.每頁筆數
* @param parameters parameters of QL(follow by sequence.) .參數(順序必須時應QL內的 ?)
* @return List of entities.物件集合
*/
public List findByCriteria(String qlCriteria, int startPageNo, int pageSize, Object... parameters);
public List findByCriteria(String qlCriteria, int startPageNo, int pageSize, Map parameters);
/**
* Query by criteria.
* QL statement will be "from " +
* {@link #getEntityName() getEntityName()} + " as " +
* {@link #getAliasName() getAliasName()} + criteria
* 條件查詢
* 實際查詢時QL會組成 "from " + {@link #getEntityName() getEntityName()} +
* " as " + {@link #getAliasName() getAliasName()} + criteria
*
* @param qlCriteria QL 的查詢條件
* @param startPageNo start page no.起始頁數
* @param pageSize page size. 每頁筆數
* @return List of entities.物件集合
*/
public List findByCriteria(String qlCriteria, int startPageNo, int pageSize);
public List findByNamedQuery(String name);
public List findByNamedQuery(String name, Object... parameters);
public List findByNamedQuery(String name, Map parameters);
/**
* Query by SQL.
* 以SQL Statement 取得查詢物件結果
*
* @param sql
* @return List of entities.物件集合
*/
public List findBySQLQuery(String sql);
public List findBySQLQuery(String sql, Object... parameters);
public List findBySQLQuery(String sql, Map parameters);
public T findUniqueByQL(String QL);
public T findUniqueByQL(String QL, Object... parameters);
public T findUniqueByQL(String QL, Map parameters);
public List findListByQL(String QL);
public List findListByQL(String QL, Object... parameters);
public List findListByQL(String QL, Map parameters);
public List findListByNamedQuery(String name);
// public List findListByNamedQuery(Class clazz, String name);
public List findListByNamedQuery(String name, Object... parameters);
// public List findListByNamedQuery(Class clazz, String name, Object... parameters);
public List findListByNamedQuery(String name, Map parameters);
// public List findListByNamedQuery(Class clazz, String name, Map parameters);
public E initLazyCollection(E entity, String collectionFieldName);
}