public List<Book> searchBookByISBNList(List<String> ISBN){
session = sessionFactory.openSession();
tx = session.beginTransaction();
String sql ="select b from Book b where b.ISBN in (:ISBNList)"; //命名參數(shù)查詢
Query query=session.createQuery(sql);
query.setParameterList("ISBNList", ISBN);
List <Book> list=query.list();
tx.commit();
session.close();
if(list.size() == 0) return null;
else return list;
}
public List<Book> searchBookByISBNList(List<String> ISBN){
session = sessionFactory.openSession();
tx = session.beginTransaction();
String sql ="select b from Book b where b.ISBN in (?0)"; //JPA占位符查詢
Query query=session.createQuery(sql);
query.setParameterList("0", ISBN);
List <Book> list=query.list();
tx.commit();
session.close();
if(list.size() == 0) return null;
else return list;
}
public List<Book> searchBookByISBNList(List<String> ISBN){
session = sessionFactory.openSession();
tx = session.beginTransaction();
String sql ="select b from Book b where b.ISBN in (?)"; //老的占位符查詢
Query query=session.createQuery(sql);
query.setParameterList("0", ISBN);
List <Book> list=query.list();
tx.commit();
session.close();
if(list.size() == 0) return null;
else return list;
}