ここで私はsetterメソッドを使用することはできませんDAOメソッド DAOメソッドでsetterを使用する必要がありますか?
@SuppressWarnings("unchecked")
public ArrayList<shopModel> viewShopinfo() {
ArrayList<shopModel> list = new ArrayList<shopModel>();
shopModel sh=new shopModel();
try
{
session.beginTransaction();
String viewQuery="SELECT * FROM shop_information";
query = session.createSQLQuery(viewQuery);
query.setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP);//To execute A Select Query
query.setParameter("storeName", sh.getStoreName());
query.setParameter("ownername", sh.getOwnername());
list = (ArrayList<shopModel>) query.list();
System.out.println("List values : "+ query.setParameter("ownername", sh.getOwnername()));
}
catch (Exception ex)
{
ex.printStackTrace();
System.out.println("Class :shopDao Method viewShopinfo Exception :"
+ ex);
}
finally
{
session.getTransaction().commit();
session.close();
}
return list;
}
JSPページ
<%
shopService shp=new shopService();
ArrayList<shopModel> list=shp.viewShopinfo();
System.out.println("welcome list : " + list.size());
for (int index=0; index<list.size(); index++)
{
System.out.println("welcome index : " + list.size());
shopModel shop = list.get(index);
System.out.println("welcome Store : " + shop.getStoreName());
%>
エラーページ
に.Class:shopDao方法viewShopinfo例外 :org.hibernate.QueryParameterException:名前付き パラメータ[storeName]が見つかりませんでした。
あなたの質問は...? – Turing85
値はモデルメソッドに保存されていません...私はデザインJSPページのすべての値を表示する必要がありますが、エラーを表示しています..ハイバーネートデータベース接続を使用しています –