?? test3.java
字號:
package com.tarena.ebank.view;
import java.util.*;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import com.tarena.ebank.biz.entriy.Account;
import com.tarena.ebank.persist.HbnUtil;
public class Test3 {
public static void main(String[] args) {
Session s=null;
try {
s=HbnUtil.getSessionFactory().openSession();
s.beginTransaction();
String hql="from Account a " +"where a.bal=?";
List l=s.createQuery(hql).setDouble(0, 6.0).list();
StringBuffer sb=new StringBuffer();
for(Account a:(List<Account>)l){
sb.append(a.getOid()+" "+a.getActNo()+" "+a.getBal()+"\n");
}
s.getTransaction().commit();
System.out.println(sb.toString());
} catch (HibernateException e) {
s.getTransaction().rollback();
}finally{
s.close();
HbnUtil.release();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -