?? customerdaoimpl.java
字號:
package com.briup.customer.dao.impl;import org.apache.commons.lang.StringUtils;import org.hibernate.Query;import org.hibernate.Session;import org.springframework.orm.hibernate3.HibernateTemplate;import com.briup.common.dao.pojo.Product;import com.briup.common.dao.pojo.User;import com.briup.customer.dao.ICustomerDao;public class CustomerDaoImpl extends HibernateTemplate implements ICustomerDao { // 修改用戶信息 public void updateCustomerInfo(User user) throws Exception { // TODO Auto-generated method stub super.saveOrUpdate(user); } // 通過品牌名稱查詢品牌信息 public Product getProductInfo(String name) throws Exception { // TODO Auto-generated method stub Query query = null; if(StringUtils.isNotEmpty(name)){ Session session = this.getSession(); query = session.createQuery("from Product where name=?"); query.setString(0, name); } return (Product) query.uniqueResult(); } // 按品牌名稱查找品牌 public Product findProductByName(String name) throws Exception { Query query = null; Session session = this.getSession(); query = session.createQuery("from Product where name=?"); query.setString(0, name); return (Product)query.uniqueResult(); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -