在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/Java  數(shù)據(jù)庫  HTML/ HIbernate的數(shù)據(jù)庫操作用法

HIbernate的數(shù)據(jù)庫操作用法

select name,sex from db 這個SQL語句使用HIbernate的中的哪個方法比較合適,例如:
public T findByID(ID id, I dbName) throws Exception;

public List<T> findAll(I dbName) throws Exception;

public List<T> findByExample(T exampleInstance, I dbName,
        String... excludeProperties) throws Exception;

public List<T> findByExample(T exampleInstance, I dbName) throws Exception;

public List<T> findByCriteria(I dbName, Criterion... criterions) throws Exception;

public List<T> findByCriteria(I dbName, List<Criterion> criterions) throws Exception;

public List<T> findByCriteria(I dbName, List<Criterion> criterions,
        List<Order> orders) throws Exception;

public List<T> findByCriteriaAndLimtSize(I dbName, int size,
        Criterion... criterions) throws Exception;

public List<T> findByCriteriaByPage(I dbName, int offsetFrom, int size,
        List<Criterion> criterions, List<Order> orders) throws Exception;
回答
編輯回答
澐染

hibernate的查詢是用query對象來進(jìn)行的,即Query query=session.createQuery(sql),在對query遍歷或者直接轉(zhuǎn)list就行。

2017年9月23日 01:43