public List findByExample(Book instance) {
log.debug("finding Book 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 Book merge(Book detachedInstance) {
log.debug("merging Book instance");
try {
Book result = (Book) getHibernateTemplate().merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
-----------------------------------------------
public void attachDirty(Book instance) {
log.debug("attaching dirty Book instance");
try {
getHibernateTemplate().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
----------------------------------------
public void attachClean(Book instance) {
log.debug("attaching clean Book instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
} public static BookDAO getFromApplicationContext(ApplicationContext ctx) {
return (BookDAO) ctx.getBean("BookDAO");
}
上面几个方法是什么意思,我现在整合ssh2,不需要使用session来进行事物处理么?
看见别人都是直接在struts里面调用dao是不是该加个中间层呢
log.debug("finding Book 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 Book merge(Book detachedInstance) {
log.debug("merging Book instance");
try {
Book result = (Book) getHibernateTemplate().merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
-----------------------------------------------
public void attachDirty(Book instance) {
log.debug("attaching dirty Book instance");
try {
getHibernateTemplate().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
----------------------------------------
public void attachClean(Book instance) {
log.debug("attaching clean Book instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
} public static BookDAO getFromApplicationContext(ApplicationContext ctx) {
return (BookDAO) ctx.getBean("BookDAO");
}
上面几个方法是什么意思,我现在整合ssh2,不需要使用session来进行事物处理么?
看见别人都是直接在struts里面调用dao是不是该加个中间层呢
解决方案 »
- 怎么取得文本框里的内容啊?然后在用split截取
- SpringSide中如何自动生成数据库
- 异常:000 ERROR LazyInitializationException:19 - could not initialize proxy - no Session
- 求教javascript和session通讯的问题
- 为什么同样的building.xml文件放置在WEB-INF目录下面,不提示错误信息,但是放置在WEB-INF同级的目录却提示错误信息。
- 请各位JAVA高手帮个忙。。。
- 独立的APPLICATION程序怎样访问WEBSPHERE服务器上的EJB资源
- 关于tomcat中配置虚拟目录的问题(新手)
- 求助!装了oracle之后系统默认的jdk变成了1.3.1!!!!
- struts2 上传文件 大小错误
- 应该买怎么样的框架书籍?
- webwork将查询数据库后的list显示到JSP中?
《搜索引擎零距离—基于Ruby+Java搜索引擎原理与实现》 清华出版社。
http://www.huachu.com.cn/itbook/itbookinfo.asp?lbbh=10105450