Hibernateを使用してデータベースから特定のレコードを取得したい。私がやりたいことは、以下の関数でコメントされています。
public List<Customer> showCustomer(long customerIdFromCustomerListPage)
throws Exception {
Session session = HibernateUtil.getSessionFactory().openSession();
Transaction transaction = null;
List<Customer> customerList = new ArrayList<Customer>();
try {
transaction = session.beginTransaction();
**//Select * from Customers where customerId="customerIdFromCustomerListPage"**
transaction.commit();
} catch (HibernateException e) {
transaction.rollback();
e.printStackTrace();
} finally {
session.close();
}
return customerList;
}