package com.dao;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Types;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.java.ResP;
import com.java.Xxuser;
import org.hibernate.Session;
/**
* A data access object (DAO) providing persistence and search support for
* Xxuser entities. Transaction control of the save(), update() and delete()
* operations can directly support Spring container-managed transactions or they
* can be augmented to handle user-managed Spring transactions. Each of these
* methods provides additional information for how to configure it for the
* desired type of transaction control.
*
* @see com.java.Xxuser
* @author MyEclipse Persistence Tools
*/
public class XxuserDAO extends HibernateDaoSupport {
private static final Log log = LogFactory.getLog(XxuserDAO.class);
// property constants
public static final String NAME = "name";
public static final String PASSWORD = "password";
public static final String DES = "des";
protected void initDao() {
// do nothing
}
public void save(Xxuser transientInstance) {
log.debug("saving Xxuser instance");
try {
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(Xxuser persistentInstance) {
log.debug("deleting Xxuser instance");
try {
getHibernateTemplate().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Xxuser findById(java.lang.Long id) {
log.debug("getting Xxuser instance with id: " + id);
try {
Xxuser instance = (Xxuser) getHibernateTemplate().get(
"com.java.Xxuser", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(Xxuser instance) {
log.debug("finding Xxuser instance by example");
try {
List results = getHibernateTemplate().findByExample(instance);
log.debug("find by example successful, result size: "
+ results.size());
return results;
} catch (RuntimeException re) {
log.error("find by example failed", re);
throw re;
}
}
public List findByProperty(String propertyName, Object value) {
log.debug("finding Xxuser instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from Xxuser as model where model."
+ propertyName + "= ?";
return getHibernateTemplate().find(queryString, value);
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
public List findByName(Object name) {
return findByProperty(NAME, name);
}
public List findByPassword(Object password) {
return findByProperty(PASSWORD, password);
}
public List findByDes(Object des) {
return findByProperty(DES, des);
}
public List findAll() {
log.debug("finding all Xxuser instances");
try {
String queryString = "from Xxuser";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public Xxuser merge(Xxuser detachedInstance) {
log.debug("merging Xxuser instance");
try {
Xxuser result = (Xxuser) getHibernateTemplate().merge(
detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public void attachDirty(Xxuser instance) {
log.debug("attaching dirty Xxuser instance");
try {
getHibernateTemplate().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(Xxuser instance) {
log.debug("attaching clean Xxuser instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
// /wsw
public List findBynmpass(String username, Long password) {
try {
String queryString = "from Xxuser as mod where mod.name='"
+ username + "' and mod.password=" + password + "";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public String seleComid(String username) throws SQLException {
try {
String procedure = "{call seleComid(?,?) }";
Session s = getHibernateTemplate().getSessionFactory().openSession();
s.beginTransaction().begin();
Connection con=s.connection();
CallableStatement cs=con.prepareCall(procedure);
cs.setString(1, username);
cs.registerOutParameter(2, Types.VARCHAR);
cs.execute();
String lo=cs.getString(2);
s.close();
System.out.println("aaaaaa+="+lo);
return lo;
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public List findBycompsid(Long id) {
try {
String queryString = "from ResP as mod where mod.comps.compsid="+id+" order by resfun.pname";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
///////
public List findByTab(String tab,String tabstr,String str) {
try {
String queryString = "from "+tab+" as mod where mod."+tabstr+"='"+str.trim()+"'";
//String queryString = "from Xxuser as model where model.name='www'";
System.out.println(queryString);
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public List findByTabId(String tab,String tabstr,Long id) {
try {
String queryString = "from "+tab+" as mod where mod."+tabstr+"="+id+"";
//String queryString = "from Xxuser as model where model.name='www'";
System.out.println(queryString);
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public List findByTabother(String tab,String tabstr1,Long str1,String tabstr2,Long str2) {
try {
String queryString = "from "+tab+" as mod where mod."+tabstr1+"="+str1+" and mod."+tabstr2+"="+str2+"";
//String queryString = "from Xxuser as model where model.name='www'";
System.out.println(queryString);
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public List findByTabPC(String tab, String tabstr1, String str1,
String tabstr2, String str2, String tabstr3, String str3) {
try {
String queryString = "from "+tab+" as mod where mod."+tabstr1+"='"+str1+"' and mod."+tabstr2+"='"+str2+"' and mod."+tabstr3+"='"+str3+"'";
//String queryString = "from Xxuser as model where model.name='www'";
System.out.println(queryString);
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public static XxuserDAO getFromApplicationContext(ApplicationContext ctx) {
return (XxuserDAO) ctx.getBean("XxuserDAO");
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
struts+hibernate+spring+oracle 车辆管理系统 (594个子文件)
XxuserDAO.class 9KB
OutcmDAO.class 9KB
UserServiceImpl.class 9KB
CarbstbDAO.class 8KB
Carbstb.class 7KB
UcapliDAO.class 7KB
DrivermDAO.class 6KB
OilmDAO.class 6KB
AnnumDAO.class 6KB
LoginAction.class 6KB
InsrmDAO.class 6KB
MainmDAO.class 6KB
ViolmDAO.class 6KB
FeesmDAO.class 6KB
FucardsDAO.class 5KB
UpCarAction.class 5KB
GraregDAO.class 5KB
SermDAO.class 5KB
ResfunDAO.class 5KB
SaveCarAction.class 5KB
RoletbDAO.class 5KB
CompsDAO.class 5KB
ResPDAO.class 5KB
RPDAO.class 5KB
URDAO.class 5KB
Driverm.class 4KB
SaveUsecarsqAction.class 4KB
Outcm.class 4KB
TaskServiceImpl.class 4KB
Oilm.class 4KB
Ucapli.class 4KB
OutcmprintAction.class 4KB
SelectoilAction.class 4KB
OilprintaAction.class 3KB
BxprintaAction.class 3KB
UpResfunAction.class 3KB
WzprintaAction.class 3KB
ByprintaAction.class 3KB
GfprintaAction.class 3KB
WxprintaAction.class 3KB
NjprintaAction.class 3KB
SaveRespAction.class 3KB
Insrm.class 3KB
OilmBean.class 3KB
SaveCarspAction.class 3KB
UpXxuserAction.class 3KB
Violm.class 3KB
Mainm.class 3KB
UpRoletbAction.class 3KB
UpCompsAction.class 3KB
UserLogin.class 3KB
SaveXxuserAction.class 3KB
Feesm.class 3KB
Serm.class 3KB
Annum.class 3KB
SaveRpAction.class 3KB
SaveUrAction.class 3KB
TakecarAction.class 2KB
SaveResfunAction.class 2KB
OutcarAction.class 2KB
UserdeleAction.class 2KB
InsrmBean.class 2KB
UsecarsqdeleAction.class 2KB
UppasswordAction.class 2KB
ResfundeleAction.class 2KB
RoledeleAction.class 2KB
ComdeleAction.class 2KB
CareditAction.class 2KB
SaveIncarAction.class 2KB
ViolmBean.class 2KB
OilprintAction.class 2KB
MainmBean.class 2KB
OutcmBean.class 2KB
SaveCompsAction.class 2KB
Fucards.class 2KB
SaveRoletbAction.class 2KB
UserService.class 2KB
CarspseleAction.class 2KB
FeesmBean.class 2KB
CarServiceImpl.class 2KB
TaskincarAction.class 2KB
SermBean.class 2KB
AnnumBean.class 2KB
OutcmdeleAction.class 2KB
SaveTakecarAction.class 2KB
Xxuser.class 2KB
RespdeleAction.class 2KB
Roletb.class 2KB
UrdeleAction.class 2KB
Comps.class 2KB
RpdeleAction.class 2KB
Test.class 2KB
Resfun.class 2KB
Grareg.class 2KB
SelectrespAction.class 1KB
SelectrpAction.class 1KB
SelecturAction.class 1KB
TaskoutcarAction.class 1KB
CarspAction.class 1KB
SeleoutcarAction.class 1KB
共 594 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
小moo
- 粉丝: 1
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功