課程
/后端開發(fā)
/Java
/基于SSH實(shí)現(xiàn)員工管理系統(tǒng)之案例實(shí)現(xiàn)篇
我用的hibernate4 不知道dao層代碼怎么寫 哪位大神能給寫一下謝謝
2017-05-11
源自:基于SSH實(shí)現(xiàn)員工管理系統(tǒng)之案例實(shí)現(xiàn)篇 2-2
正在回答
public Employee findByUsernameAndPassword(Employee employee) { ? ?Session session = this.getSessionFactory().openSession(); ? ?Transaction tx = session.beginTransaction(); ? ?String hql2 = "from Employee e where e.username= '"+employee.getUsername()+"' and e.password = '"+employee.getPassword()+"'"; ? ?Query q = session.createQuery(hql2); ? ?List<Employee> list =q.list(); ? ?if(list.size()>0){ ? ? ? ?return list.get(0); ? ?} ? ?tx.commit(); ? ?session.close(); ? ?return null;}
慕粉1937076946 提問者
非常感謝上面的
慕圣4033286
舉報(bào)
SSH框架整合案例之實(shí)現(xiàn)篇,手把手帶你實(shí)現(xiàn)員工管理系統(tǒng)
1 回答我是用的hibernate4,dao中的代碼要怎么寫?
4 回答hibernate4中dao層繼承那個(gè)類
2 回答哪位大神發(fā)jar包給我
2 回答需要大神幫忙看一下,謝謝
2 回答誰有這項(xiàng)目的jar包?能分享給我下么,謝謝。
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2017-05-12
public Employee findByUsernameAndPassword(Employee employee) {
? ?Session session = this.getSessionFactory().openSession();
? ?Transaction tx = session.beginTransaction();
? ?String hql2 = "from Employee e where e.username= '"+employee.getUsername()+"' and e.password = '"+employee.getPassword()+"'";
? ?Query q = session.createQuery(hql2);
? ?List<Employee> list =q.list();
? ?if(list.size()>0){
? ? ? ?return list.get(0);
? ?}
? ?tx.commit();
? ?session.close();
? ?return null;
}
2017-09-06
非常感謝上面的