📄 funddao.java
字号:
package com.funddeal.model.dao.fund;
import java.util.List;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Query;
import net.sf.hibernate.Session;
import com.funddeal.base.SessionCommit;
import com.funddeal.model.pojo.fund.Fund;
public class FundDAO {
public static String errorMsg="";
private SessionCommit session;
public FundDAO()
{
try {
session=new SessionCommit();
} catch (HibernateException e) {
e.printStackTrace();
}
}
//添加基金产品
public String AddFund(Fund f) throws HibernateException
{
return session.getSessionAdd(f);
}
//查询基金产品
public List SearchFund(String i,String fundName) throws HibernateException
{
SessionCommit scm=new SessionCommit();
Session session=scm.getSession();
String str="";
if(i.equals("1"))
str="from Fund fund where fund.fundNo='"+fundName+"'";
else
str="from Fund fund where fund.fundName='"+fundName+"'";
Query query=session.createQuery(str);
List list=query.list();
return list;
}
//修改基金产品
public boolean UpdateFund(Fund fund) throws HibernateException
{
boolean bn=session.getSessionUpdate(fund);
if(!bn)errorMsg=SessionCommit.errorMsg;
return bn;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -