在项目中和数据库中表映射的 *.hbm.xml
<hibernate-mapping>
<class lazy="false"> 在<class>元素中添加lazy="false"
</class>
<hibernate-mapping>
<hibernate-mapping>
<class lazy="false"> 在<class>元素中添加lazy="false"
</class>
<hibernate-mapping>
解决方案 »
- 开发web Service用CXF还是Axis2,哪个好
- varchar(length)跟datetime哪种更占空间
- 请大家帮忙看看显示代码有什么问题
- 做网站的统计的时候怎样知道浏览者已经离开网站?
- struts2与webservice开发有没有进行整合?
- hibernate删除的问题
- jspSmartUpload 下载中文问题
- 一个关于字符串输出怎样控制小数位数的问题.
- 请问在jsp中如何实现相对路径?我在jsp文件中指定相对路径的文件,可是程序找不到!
- 正则,保留小数点有两位数字,有效范围在[-10000000,+10000000]之内
- 带进度显示的文件下载
- 关于EJB3的问题 ,请大侠赐教
Assert.notNull(action, "Callback object must not be null");
Session session = getSession();
boolean existingTransaction = SessionFactoryUtils.isSessionTransactional(session, getSessionFactory());
if (existingTransaction) {
logger.debug("Found thread-bound Session for HibernateTemplate");
}
FlushMode previousFlushMode = null;
try {
previousFlushMode = applyFlushMode(session, existingTransaction);
enableFilters(session);
Session sessionToExpose = (exposeNativeSession ? session : createSessionProxy(session));
Object result = action.doInHibernate(sessionToExpose); flushIfNecessary(session, existingTransaction);
return result;
}
catch (HibernateException ex) {
throw convertHibernateAccessException(ex);
}
catch (SQLException ex) {
throw convertJdbcAccessException(ex);
}
catch (RuntimeException ex) {
// Callback code threw application exception...
throw ex;
}
finally {
if (existingTransaction) { //你错误出现信息地方 logger.debug("Not closing pre-bound Hibernate Session after HibernateTemplate");
disableFilters(session);
if (previousFlushMode != null) {
session.setFlushMode(previousFlushMode);
}
}
else {
// Never use deferred close for an explicitly new Session.
if (isAlwaysUseNewSession()) {
SessionFactoryUtils.closeSession(session);
}
else {
SessionFactoryUtils.closeSessionOrRegisterDeferredClose(session, getSessionFactory());
}
}
}
}