所以我能夠在公司ID通過使用Hibernate獲得公司信息,代碼如下:Hibernate實現由通在不同類型則params的
public Company getCompanyById(Integer companyId) {
Company company = (Company) getCurrentSession().get(Company.class, companyId);
return company;
}
現在我所要做的是通過在公司名稱,地址和手機號碼,以獲得公司。在我腦海中的方法是這樣的:
public Company getCompanyByNameAddressCellphone(String companyName, String address, Integer cellPhoneNumber);
我該如何實現它?
使用Hibernate查詢數據庫的多個途徑 - HQL查詢,標準的API,SQL查詢 –
@SubhrajyotiMajumder您可以發佈這個詳細的回答? – OPK
Hibernate文檔[鏈接](https://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/index.html) - 1. [HQL](https://docs.jboss。 org/hibernate/orm/4.3/manual/en-US/html/ch16.html)2. [Criteria API](https://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html /ch17.html) 3. [SQL](https://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/ch18.html) –