Spring、hibernate集成的时候list save的问题 [问题点数:40分,结帖人a379992210]

Bbs1
本版专家分:20
Blank
GitHub 绑定GitHub第三方账户获取
结帖率 94.74%
Bbs1
本版专家分:20
Blank
GitHub 绑定GitHub第三方账户获取
Bbs5
本版专家分:3075
Bbs1
本版专家分:20
Blank
GitHub 绑定GitHub第三方账户获取
hibernate save
public void <em>save</em>List(Param param,List planPriceList){ Date date=new Date(); SimpleDateFormat
hibernate保存或者修改List集合
getHibernateTemplate().<em>save</em>OrUpadateAll(<em>list</em>);
hibernate save时候报错
[color=#993300]<em>hibernate</em> ORA-01400: 无法将 NULL 插入[/color]rnrn前提是,我确认我插入的这个值并不是Null ,而是""。不知道Hibernate怎么报错的。数据库使用的是oracle。rn主键策略使用uuid
Hibernate在save时候出错!
我在SAVE()的<em>时候</em>,报了The user must supply a JDBC connection的EXCEPTION,不是知道是什么原因,都搞了一上午了!应该不是驱动的<em>问题</em>!请大家指教!
测试springhibernate集成时候出现的问题
在junit测试的<em>时候</em>,出现了<em>spring</em>在创建bean,userDao错误。找了很久的<em>问题</em>才找到。第一个是  这一块配置错误,目前我是注释掉的。第二个是事务配置上出<em>问题</em>了。 我开始使用的是 拦截器方式配置事物,后来改成了注解方式配置事务,在serviceImpl的方法上加事务注解@Transactional,成功解决该<em>问题</em>,但是现在我
Spring 和Hibernate集成问题
写了个简单的 <em>集成</em> rn 出现了如下<em>问题</em> rnrn 21:40:36,015 WARN Configurator:126 - No configuration found. Configuring ehcache from rnrnehcache-failsafe.xml found in the classpath: jar:file:/C:/Program%20Files/MyEclipse%205.5%rnrn20GA/myeclipse/eclipse/plugins/com.genuitec.org.<em>hibernate</em>.eclipse_5.5.0/myeclipse-rnrndata/3.0/lib/ehcache-1.1.jar!/ehcache-failsafe.xmlrn21:40:36,484 WARN JDBCExceptionReporter:48 - SQL Warning: 0, SQLState: rn21:40:36,484 WARN JDBCExceptionReporter:49 - [Microsoft][SQLServer 2000 Driver for JDBC]rnrnDatabase changed to skyrn21:40:36,484 WARN JDBCExceptionReporter:48 - SQL Warning: 5701, SQLState: 01000rn21:40:36,484 WARN JDBCExceptionReporter:49 - [Microsoft][SQLServer 2000 Driver for JDBC]rnrn[SQLServer]已将数据库上下文改为 'sky'。rn21:40:36,484 WARN JDBCExceptionReporter:48 - SQL Warning: 0, SQLState: rn21:40:36,484 WARN JDBCExceptionReporter:49 - [Microsoft][SQLServer 2000 Driver for JDBC]rnrnLanguage changed to 简体中文rn21:40:36,484 WARN JDBCExceptionReporter:48 - SQL Warning: 5703, SQLState: 01000rn21:40:36,484 WARN JDBCExceptionReporter:49 - [Microsoft][SQLServer 2000 Driver for JDBC]rnrn[SQLServer]已将语言设置改为 简体中文。rnrn 使得对数据库的操作无法执行 知道的告诉下 真的谢谢了 rnrnrn代码参见 rnrn rn- rn- rn rn rn- rn rn rn- rn rn rn rnrnrnpackage com.guest.client;rnrnimport org.<em>spring</em>framework.beans.factory.BeanFactory;rnimport org.<em>spring</em>framework.context.support.ClassPathXmlApplicationContext;rnrnrnimport com.guest.usermangerImpl.UsermangerImpl;rnrnpublic class client rnrn /**rn * @param argsrn */rn public static void main(String[] args) rn rn rnrn BeanFactory factory = new ClassPathXmlApplicationContext("applicationContext.xml");rn UsermangerImpl userManager = (UsermangerImpl)factory.getBean("guestbookmanger");rn try rn userManager.delect(7);rn catch (Exception e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn rn rn rnrn rn
spring集成hibernate问题
public class myDao extends HibernateDaoSupport rn rn public List method1() rn String hql = "from users";rn Query query = getSession().createQuery(hql);rn return query.<em>list</em>();rn rnrn public List method2() rn return this.getHibernateTemplate().executeFind(new HibernateCallback() rn public Object doInHibernate(Session session) throws HibernateException, SQLException rn String hql = "from users";rn Query query = session.createQuery(hql);rn List <em>list</em> = query.<em>list</em>();rn return <em>list</em>;rn rn );rn rnrnrnrn请问方法一和方法二有没有区别,区别在哪里?rnrn
怎么用Hibernate 保存一个 list 集合
是这样的,需要用 Hibernate 保存一个 List 这样的一个集合,有没有直接保存 List 对象的方法?感觉 Hibernate 应该有这种方法吧。不过我试了半天都没试出来,现在的
hibernate save集合时只有一个值
List <em>list</em>s = getList(); List con<em>list</em>s = new ArrayList(); A a = new A(); for(D <em>list</em>:<em>list</em>s){ a.setB(b); a.setC(c); con<em>list</em>s.add(a); } this.<em>save</em>(<em>list</em>s); 这样存到数据库的值只有一个,原因就是 循环里的对象 只有一个a对象,<em>save</em>的<em>时候</em>
SSH框架之Hibernate的List集合映射、数组映射、List集合的数据保存
一、List集合映射 1、数据库设计: 2、代码实现 1)javabean:User.java 2)User.hbm.xml: 3)测试类:App.java 3、结果: 1)t_user表: 2)t_address<em>list</em>表:
getHibernateTemplate().saveOrUpdateAll(list)只保存了最后一条
循环插入
Hibernate 实现批量添加数据
Hibernate 实现批量添加数据 1.Hibernate_016_BatchAddData程序目录结构: 2.lib目录下所引入的jar包: 3.MedicineDao.java源代码: package com.xqh.dao; import java.util.List; import org.<em>hibernate</em>.Session; import com.
hibernate save时候能不能save一个map??
如题,我想保存数据时使用HashMap来代替Pojo,这样可以降低逻辑层和持久层的耦合度,请问可以吗?
hibernate spring集成做事务管理的时候异常
Exception in thread "main" org.<em>spring</em>framework.beans.factory.BeanCreationException: Error creating bean with name 'userManager' defined in file [E:\java\Hibernate_<em>spring</em>2\bin\applicationContext-beans.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.<em>spring</em>framework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sessionFactory': Bean with name 'sessionFactory' has been injected into other beans [txManager] in its raw version as part of a circular reference, but has eventually been wrapped (for example as part of auto-proxy creation). This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesOfType' with the 'allowEagerInit' flag turned off, for example.rnCaused by: org.<em>spring</em>framework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sessionFactory': Bean with name 'sessionFactory' has been injected into other beans [txManager] in its raw version as part of a circular reference, but has eventually been wrapped (for example as part of auto-proxy creation). This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesOfType' with the 'allowEagerInit' flag turned off, for example.rn at org.<em>spring</em>framework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:423)rn at org.<em>spring</em>framework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)rn at org.<em>spring</em>framework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)rn at org.<em>spring</em>framework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)rn at org.<em>spring</em>framework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)rn at org.<em>spring</em>framework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:246)rn at org.<em>spring</em>framework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:128)rn at org.<em>spring</em>framework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:955)rn at org.<em>spring</em>framework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:729)rn at org.<em>spring</em>framework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:416)rn at org.<em>spring</em>framework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)rn at org.<em>spring</em>framework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)rn at org.<em>spring</em>framework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)rn at org.<em>spring</em>framework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)rn at org.<em>spring</em>framework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:290)rn at org.<em>spring</em>framework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:348)rn at org.<em>spring</em>framework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:92)rn at org.<em>spring</em>framework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:77)rn at org.<em>spring</em>framework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:68)rn at com.dlm.client.Client.main(Client.java:13)rn我是看王勇的视频写的,不知道怎么出异常了rn
hibernate集成spring的延迟加载问题
在web.xml配置了OpenSessionInViewFilter,实体类配置文件User.hbm.xml文件也配置了lazy="true" 但是在调用load()的方法的<em>时候</em>总是说session已经关闭,什么原因?rnorg.<em>hibernate</em>.LazyInitializationException: could not initialize proxy - no Session
关于spring集成hibernate问题
我只会单独使用<em>hibernate</em>或者<em>spring</em>, 还没有<em>集成</em>他们使用过, 能不能简要的介绍一下?
Spring 集成 Hibernate事务问题
Spring <em>集成</em> Hibernate事务<em>问题</em>rnrnrn今天碰上了个<em>问题</em>, 在Spring <em>集成</em> Hibernate事务时我记得事务传播属性为PROPAGATION_REQUIRED时产生内部异常时事务会回滚,但今天我在做实验时在被事务管理的方法中进行了数据库操作后强行抛出Exception异常,rn但异常并没有使事务回滚,起初我以为是配置的<em>问题</em>,但在事务传播属性里加入-Exception,事务传播属性定义改为以下的样子:rnrn rn PROPAGATION_REQUIRED,-Exceptionrn rnrn再运行程序事务可以回滚,我想问事物传播属性的缺省定义PROPAGATION_REQUIRED会不会产生事务回滚? 如果能产生回滚哪些异常会使事务回滚?rn请朋友们指点一下.rn
hibernate 循环遍历 list对象,只保存最后一条数据,偶现
-
Hibernate保存对象集合到数据库问题
1、有一个List集合,Object为Hibernate映射对象。 2、采用getHibernateTemplate().<em>save</em>OrUpdateAll(<em>list</em>)保存不进去。 3、从
在Spring集成Hibernate后,进行save操作报错
在进行<em>save</em>操作时抛出Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.异常rnrn在网上找了许久,全是千篇一律。基本上都是说在web.xml的过滤器加FlushMode,但是我这个只有Spring+Hibernate,哪来的web.xml。也有说加事务处理的,但是我加了事务,测试了无数遍,还是不行,请大神们帮忙下,谢谢,下面是我的xml配置rnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn PROPAGATION_SUPPORTS rn rn rn rn rn rn rn rn rn rn rn rn rn rn transactionInterceptorrn rn rn rn rnrnrn下面是具体错误信息rnException in thread "main" org.<em>spring</em>framework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.rn at org.<em>spring</em>framework.orm.<em>hibernate</em>5.HibernateTemplate.checkWriteOperationAllowed(HibernateTemplate.java:1093)rn at org.<em>spring</em>framework.orm.<em>hibernate</em>5.HibernateTemplate.lambda$update$13(HibernateTemplate.java:658)rn at org.<em>spring</em>framework.orm.<em>hibernate</em>5.HibernateTemplate.doExecute(HibernateTemplate.java:383)rn at org.<em>spring</em>framework.orm.<em>hibernate</em>5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:349)rn at org.<em>spring</em>framework.orm.<em>hibernate</em>5.HibernateTemplate.update(HibernateTemplate.java:657)rn at org.<em>spring</em>framework.orm.<em>hibernate</em>5.HibernateTemplate.update(HibernateTemplate.java:652)rn at com.yiibai.stock.dao.impl.StockDaoImpl.update(StockDaoImpl.java:17)rn at com.yiibai.stock.bo.impl.StockBoImpl.update(StockBoImpl.java:20)rn at com.yiibai.common.App.main(App.java:28)
在myeclipse下集成Spring和Hibernate的问题
在配置<em>spring</em>的<em>时候</em>,找不到添加项"Spring 2.0 ORM/DAO/Hibernate3 Libraries"
Struts、Spring、Hibernate集成
使用Struts、Spring、Hibernate<em>集成</em>技术 实现查询ORACLE数据库中EMP表中的所有雇员
springhibernate集成Demo
<em>spring</em>2.5和<em>hibernate</em>3.3<em>集成</em>的小Demo.
集成springhibernate懒加载
解决org.<em>hibernate</em>.LazyInitializationException: could not initialize proxy - no Session...
JSF集成Spring、Hibernate
JSF<em>集成</em>Spring、Hibernate jar包完整版 tomcat6或其他web服务器下部署运行。 (tomcat5 启动报错) 连接sqlserver 数据库。
FLEX和springhibernate集成
FLEX和<em>spring</em>、<em>hibernate</em>的<em>集成</em> FLEX和<em>spring</em>、<em>hibernate</em>的<em>集成</em> FLEX和<em>spring</em>、<em>hibernate</em>的<em>集成</em>
Hibernate和spring集成
NULL 博文链接:https://1136051009.iteye.com/blog/1772776
Spring与Hibernate集成
NULL 博文链接:https://pan33.iteye.com/blog/1147543
Spring 与hibernate集成
博文链接:https://shaqiang32.iteye.com/blog/201919
Spring与Struts、Hibernate的集成
Spring Struts Hibernate <em>集成</em> ppt
struts + hibernate +spring集成
struts + <em>hibernate</em> +<em>spring</em><em>集成</em>
shiro集成hibernatespring
采用的是maven管理工程 项目架构是 <em>spring</em>mvc4.2.4.RELEASE+<em>spring</em>4.2.4.RELEASE+shiro1.22+<em>hibernate</em>5.1.0.Final 前端框架采用的是bootstrap 实现了角色+权限+用户的控制,另外为了能够更好的查看效果我加了一个实体类 即Info 权限才用的是注解方式 root -> admin可以添加角色,在添加的<em>时候</em>就可以选择所有的权限 其他用户可以根据权限的情况能够增加Info删除Info查看Info 然后是密码采用的是Base64加密 加密思路为 加密密码 String pass = password+salt(盐)==>然后调用Base64UU工具类的setString获取到加密密码 然后把加密密码和salt存入数据库 ---&gt;salt我是用uuid生成然后截取前面15位 解密同样很简单的String password = Base64UU.getString(password+salt); 解密后的密码要注意假如你的密码是123456盐是xxsdgshsgs 那么解密后的密码是123456xxsdgshsgs,利用String的截取方法截取password即可 String pass = Base64UU.getString(user.getPassword()); pass = pass.substring(0,pass.lastIndexOf(user.getSalt())); UserRealm Class主要是身份验证以及验证成功利用username获取角色和权限,然后在注入Subject中 之后就可以在Controller上面利用注解比如: @RequiresPermissions(value = { "user:select" }) 当然也可以利用Spring的aop也是一样呢 假如发现<em>问题</em>可以联系本人QQ134266212 或者邮箱noatnu@163.com
集成 Struts2/Spring/Hibernate
详细讲解,<em>集成</em>Struts2/ Spring / Hibernate的过程。
Spring集成Hibernate学习笔记
Spring<em>集成</em>Hibernate,Spring配置文件需要做的修改为: 1、配置数据源(dataSource)。 2、配置sessionFactory,Spring的主要类有AnnotationSessionFactoryBean(注解方式)和LocalSessionFactoryBean(hbm配置文件方式)。   Spring<em>集成</em>Hibernate后,可提供如下方式的操作: 1、...
Hibernate与Spring集成示例
写了MyBatis与Spring的<em>集成</em>,今天写写Hibernate与Spring的<em>集成</em>。以前是别人<em>集成</em>好了自己直接用,今天自己<em>集成</em>一下。与MyBatis学习笔记系列一样,本篇依然采用courseman数据库(数据库的创建请参见笔者博客:MyBatis入门示例),及ant来管理工程(对ant不熟悉的朋友请参见笔者的相关博客:ant的下载与安装,ant入门示...
Struts2,spring,Hibernate集成
NULL 博文链接:https://yusudong.iteye.com/blog/962170
Spring集成Hibernate
Spring<em>集成</em>Hibernate,有数据库和日志说明。
Flex、Spring、Hibernate 集成
通过这篇文章,您能清晰地了解由 Flex、Spring、Hibernate <em>集成</em>的 RIA 应用框架的技术细节以及怎样使用该框架开发具体的应用。
stuts2 spring hibernate 集成
完整的SSH<em>集成</em>,STRUTS2.0+SPRING 2.5+ HIBERNATE 3.6完美<em>集成</em>
struts2 spring hibernate集成
struts2 <em>spring</em> <em>hibernate</em><em>集成</em> 介绍上传下载。。
spring集成Struts与Hibernate
关于<em>spring</em><em>集成</em>Struts+Hibernate的详细介绍,欢迎大家借鉴!
spring集成hibernate
<em>hibernate</em><em>集成</em><em>spring</em>的实例,让你一看就懂
CXF集成spring hibernate
自己在用的接口框架,实现了CXF和<em>spring</em>和<em>hibernate</em>的<em>集成</em>
spring集成Hibernate
本文主要讲解如何在Spring4.0.4下整合Hibernate4.3.6; 主要介绍了如下内容: 项目结构的规划; Spring MVC的配置和使用; Spring下整合Hibernate的具体过程; 数据源的配置; jdbcTemplate和HibernateTemplate两种方式操作数据库;
Spring Hibernate 集成的例子
NULL 博文链接:https://xwhoyeah.iteye.com/blog/517879
Spring与Hibernate集成---声明式事务
NULL 博文链接:https://chenming47.iteye.com/blog/437199
Spring与Hibernate集成声明式事务
      看到你一个熟悉好像也陌生的样子,Spring、Hibernate、事务。问问你名字背后的含义,Spring简单来说是一个轻量级的控制反转IOC和面向切面AOP的容器框架;Hibernate是一个开放代码源对象关系映射框架;事务Transaction是访问并可能更新数据库中各种数据项的一个程序执行单元。       它们之间<em>集成</em>管理的关系,<em>spring</em>是中间的桥梁,对事物的管理有多种方...
springhibernate集成
<em>spring</em> 与<em>hibernate</em>的<em>集成</em>方法 <em>spring</em> 与<em>hibernate</em>的<em>集成</em>方法
Struts,Spring与hibernate集成
Struts,Spring与<em>hibernate</em>的整合文档提供参考。
struts2 + spring + hibernate集成
博文链接:https://kdisk-sina-com.iteye.com/blog/235792
集成Spring和SpringMVC和Hibernate下
将前面讲过的Spring5、SpringMVC、Hibernate5和前端框架Easyui整合起来最终完成一个基于角色和资源的权限控制模型,完全当成真实的项目来做的,能让同学们进一步的提升实战开发能力!
hibernatesave问题
数据库中有个记录时间的字段,用了getdate()方法,怎么用<em>hibernate</em>的<em>save</em>方法把该对象保存到数据库里面?
Spring集成Hibernate注意事项
项目原先有SpringMVC框架,后台希望加上<em>hibernate</em>框架的可以起看下,或者希望Spring<em>集成</em><em>hibernate</em>。这里我用的是Spring4.2.1和<em>hibernate</em>4.3 web.xm上需要添加     SpringOpenSessionInViewFilter   org.<em>spring</em>framework.orm.<em>hibernate</em>4.support.OpenSe
spring 与Hibernate集成的配置
首先建个web项目,导入所需要的包,包名在这列出: [code=&quot;java&quot;] <em>hibernate</em>3.3所用到的jar包: antlr-2.7.6.jar 开源语法分析生成器(lib\required) commons-collections-3.1.jar Commons集合类库,与连接池有关(lib\required) dom4j-1....
struts spring hibernate 集成
struts <em>spring</em> <em>hibernate</em> <em>集成</em>
struts2 hibernate spring集成
struts2 <em>hibernate</em> <em>spring</em> <em>集成</em>
spring hibernate集成
只将<em>spring</em>和<em>hibernate</em><em>集成</em>
Spring集成Hibernate myeclipse 下
Myeclipse 环境下 Spring <em>集成</em>Hibernate 示例
spring mvc hibernate集成
<em>spring</em> mvc <em>hibernate</em><em>集成</em> 基础框架 c3p0 oracle
struts2、springhibernate集成
struts2、<em>spring</em>和<em>hibernate</em>的<em>集成</em>
springhibernate集成
public Books selectOneBooks(int id) rn System.out.println(id);rn String hql="from Books where id="+id;rn System.out.println(hql);rn List <em>list</em>=super.getHibernateTemplate().find(hql);rn return (Books)<em>list</em>;rn //return (Books)this.getHibernateTemplate().get(Books.class, id);rn rn rn这里总是抛出如下异常:rnrn1rnfrom Books where id=1rnException in thread "main" org.<em>spring</em>framework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL [select books0_.id as id, books0_.skid as skid10_, books0_.gsid as gsid10_, books0_.bname as bname10_, books0_.bprice as bprice10_, books0_.bpicture as bpicture10_, books0_.bnumber as bnumber10_, books0_.bauthor as bauthor10_, books0_.bdate as bdate10_, books0_.bproduce as bproduce10_, books0_.bdescribe as bdescribe10_ from study.dbo.books books0_ where books0_.id=1]; SQL state [HY000]; error code [0]; [Microsoft][SQLServer 2000 Driver for JDBC]Value can not be converted to requested type.; nested exception is java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Value can not be converted to requested type.rnjava.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Value can not be converted to requested type.rn at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)rn at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)rn at com.microsoft.jdbc.base.BaseData.getFloat(Unknown Source)rn at com.microsoft.jdbc.base.BaseResultSet.getFloat(Unknown Source)rn at com.microsoft.jdbc.base.BaseResultSet.getFloat(Unknown Source)rn at org.apache.commons.dbcp.DelegatingResultSet.getFloat(DelegatingResultSet.java:242)rn at org.<em>hibernate</em>.type.FloatType.get(FloatType.java:21)rn at org.<em>hibernate</em>.type.NullableType.nullSafeGet(NullableType.java:77)rn at org.<em>hibernate</em>.type.NullableType.nullSafeGet(NullableType.java:68)rn at org.<em>hibernate</em>.type.AbstractType.hydrate(AbstractType.java:80)rn at org.<em>hibernate</em>.persister.entity.BasicEntityPersister.hydrate(BasicEntityPersister.java:1690)rn at org.<em>hibernate</em>.loader.Loader.loadFromResultSet(Loader.java:991)rn at org.<em>hibernate</em>.loader.Loader.instanceNotYetLoaded(Loader.java:942)rn at org.<em>hibernate</em>.loader.Loader.getRow(Loader.java:855)rn at org.<em>hibernate</em>.loader.Loader.getRowFromResultSet(Loader.java:305)rn at org.<em>hibernate</em>.loader.Loader.doQuery(Loader.java:412)rn at org.<em>hibernate</em>.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)rn at org.<em>hibernate</em>.loader.Loader.doList(Loader.java:1593)rn at org.<em>hibernate</em>.loader.Loader.<em>list</em>(Loader.java:1577)rn at org.<em>hibernate</em>.loader.hql.QueryLoader.<em>list</em>(QueryLoader.java:395)rn at org.<em>hibernate</em>.hql.ast.QueryTranslatorImpl.<em>list</em>(QueryTranslatorImpl.java:271)rn at org.<em>hibernate</em>.impl.SessionImpl.<em>list</em>(SessionImpl.java:844)rn at org.<em>hibernate</em>.impl.QueryImpl.<em>list</em>(QueryImpl.java:74)rn at org.<em>spring</em>framework.orm.<em>hibernate</em>3.HibernateTemplate$31.doInHibernate(HibernateTemplate.java:853)rn at org.<em>spring</em>framework.orm.<em>hibernate</em>3.HibernateTemplate.execute(HibernateTemplate.java:366)rn at org.<em>spring</em>framework.orm.<em>hibernate</em>3.HibernateTemplate.find(HibernateTemplate.java:844)rn at org.<em>spring</em>framework.orm.<em>hibernate</em>3.HibernateTemplate.find(HibernateTemplate.java:836)rn at com.Study_HappyGo.dao.BooksdaoImp.selectOneBooks(BooksdaoImp.java:23)rn at test.test.BooksDaotest(test.java:26)rn at test.test.main(test.java:64)rn
Hibernate集成Spring 的疑问!
请问Hibernate<em>集成</em>Spring后Session session = this.getSession();rn需要session.close()吗??????我记的好想不用吧``会自动关闭?rnrn[code=Java]rnpackage com.htky.dao;rnrnimport java.util.Iterator;rnimport java.util.List;rnrnimport org.<em>hibernate</em>.Criteria;rnimport org.<em>hibernate</em>.Query;rnimport org.<em>hibernate</em>.SQLQuery;rnimport org.<em>hibernate</em>.Session;rnimport org.<em>spring</em>framework.context.ApplicationContext;rnimport org.<em>spring</em>framework.context.support.ClassPathXmlApplicationContext;rnimport org.<em>spring</em>framework.orm.<em>hibernate</em>3.support.HibernateDaoSupport;rnrnimport com.htky.po.AA;rnimport com.htky.po.TabBill;rnimport com.htky.po.TabScan;rnimport com.ibatis.sqlmap.engine.builder.xml.XmlConverter;rnrnpublic class HtkyDao extends HibernateDaoSupportrn public List getAll()rn Session session = this.getSession();rn Query query = session.createQuery("from TabScan a,TabBill b where a.billCode=b.billCode and a.billCode='B000001897209'");rn List <em>list</em> = query.<em>list</em>();rn session.close();rn return <em>list</em>;rn rn public static void main(String[] args)rn ApplicationContext app = new ClassPathXmlApplicationContext("<em>spring</em>_ioc.xml");rn HtkyDao dao = (HtkyDao)app.getBean("trackdao");rn List <em>list</em> = dao.getAll();rn Iterator it = <em>list</em>.iterator();rn TabBill bill = null;rn while(it.hasNext())rn Object[] o = (Object[]) it.next();rn TabScan scan = (TabScan)o[0];rn bill = (TabBill)o[1];rn rn rn System.out.println(bill.getSignMan());rn rn// rn rnrnrn[/code]rnrn需要关闭吗?rn如果需要关闭!我如何return
Spring和Struts和Hibernate集成
NULL 博文链接:https://whp0731.iteye.com/blog/358203
Spring、Hibernate集成
NULL 博文链接:https://thw.iteye.com/blog/1190560
hibernate Save问题.
我有3个表, rn类型, 书籍, 作者. rn 关系是: 书籍 一对多 类型 ; 书籍 一对多 作者;rnrn映射如下:rnType rn rnString id; rnString name; rnSet book; rn rnrnBook rn rnString id; rnString name; rnType type; rnAuthor author; rn rnrnAuthorrn rnString id; rnString name; rnSet book; rn rn这个关系我需要怎么添加进数据库. rn是通过书籍添加还是通过类型跟作者添加呢. rn如果那本书的作者有了的要就要怎么添加? rnrn下面这个添加是否是添加了3行数据? rnAuthor bb =new Author(); rnbb.setId("111"); rnbb.setName("xxx1"); rnrnType cc =new Type(); rncc.setId("111"); rncc.setName("xxx1"); rnrnBook aa =new Book(); rnaa.setId("111"); rnaa.setName("xxx1"); rnaa.setAuthor(bb); rnaa.setType(cc); rnsession.<em>save</em>(aa); rnrnrn但是如果我的类型或者作者在数据库里有了是否需要先找出来? rn象下面这样? rnAuthor bb =session.ge(Author.class,id); rnrnType cc=session.ge(Type.class,id); rnrnBook aa=new book(); rnaa.setId("111"); rnaa.setName("xxx1"); rnaa.setAuthor(bb); rnaa.setType(cc); rnsession.<em>save</em>(aa); rn这个样子他是不是又会保存3条数据,从而出错呀?rnrn在数据存在的情况下能不能不查询数据库,只需要写ID? rn象这样? rnrnAuthor bb =new Author(); rnbb.setId("111")//; rnrnrnType cc =new Type(); rnbb.setId("111")//; rnrnBook aa =new Book(); rnaa.setId("111"); rnaa.setName("xxx1"); rnaa.setAuthor(bb); rnaa.setType(cc); rnsession.<em>save</em>(aa); rn
hibernate中的save问题
javax.servlet.ServletException: org.<em>spring</em>framework.dao.InvalidDataAccessApiUsageException: com.entity.User; nested exception is org.<em>hibernate</em>.TransientObjectException: com.entity.Userrn org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:535)rn org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:433)rn org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)rn org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)rn org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:710)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn com.util.FilterClass.doFilter(FilterClass.java:24)rnrnrnroot cause rnrnorg.<em>spring</em>framework.dao.InvalidDataAccessApiUsageException: com.entity.User; nested exception is org.<em>hibernate</em>.TransientObjectException: com.entity.Userrn org.<em>spring</em>framework.orm.<em>hibernate</em>3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:633)rn org.<em>spring</em>framework.orm.<em>hibernate</em>3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)rn org.<em>spring</em>framework.orm.<em>hibernate</em>3.HibernateTemplate.execute(HibernateTemplate.java:377)rn org.<em>spring</em>framework.orm.<em>hibernate</em>3.HibernateTemplate.execute(HibernateTemplate.java:338)rn com.dao.daoimpl.BodycheckDaoImpl.adduserinfo(BodycheckDaoImpl.java:42)rn com.delegate.delegateimpl.BodycheckdelegateImpl.adduserinfo(BodycheckdelegateImpl.java:24)rn com.web.struts.action.BodyCheckAction.adduserinfo(BodyCheckAction.java:69)rn sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn java.lang.reflect.Method.invoke(Unknown Source)rn org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)rn org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)rn org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)rn org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)rn org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)rn org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:710)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn com.util.FilterClass.doFilter(FilterClass.java:24)rnrnrnroot cause rnrnorg.<em>hibernate</em>.TransientObjectException: com.entity.Userrn org.<em>hibernate</em>.engine.ForeignKeys.getEntityIdentifierIfNotUn<em>save</em>d(ForeignKeys.java:216)rn org.<em>hibernate</em>.type.EntityType.getIdentifier(EntityType.java:108)rn org.<em>hibernate</em>.type.ManyToOneType.isDirty(ManyToOneType.java:221)rn org.<em>hibernate</em>.type.TypeFactory.findDirty(TypeFactory.java:476)rn org.<em>hibernate</em>.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:2803)rn org.<em>hibernate</em>.event.def.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:467)rn org.<em>hibernate</em>.event.def.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:190)rn org.<em>hibernate</em>.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:113)rn org.<em>hibernate</em>.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:195)rn org.<em>hibernate</em>.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)rn org.<em>hibernate</em>.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)rn org.<em>hibernate</em>.impl.SessionImpl.flush(SessionImpl.java:985)rn org.<em>spring</em>framework.orm.<em>hibernate</em>3.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:390)rn org.<em>spring</em>framework.orm.<em>hibernate</em>3.HibernateTemplate.execute(HibernateTemplate.java:373)rn org.<em>spring</em>framework.orm.<em>hibernate</em>3.HibernateTemplate.execute(HibernateTemplate.java:338)rn com.dao.daoimpl.BodycheckDaoImpl.adduserinfo(BodycheckDaoImpl.java:42)rn com.delegate.delegateimpl.BodycheckdelegateImpl.adduserinfo(BodycheckdelegateImpl.java:24)rn com.web.struts.action.BodyCheckAction.adduserinfo(BodyCheckAction.java:69)rn sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn java.lang.reflect.Method.invoke(Unknown Source)rn org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)rn org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)rn org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)rn org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)rn org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)rn org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:710)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn com.util.FilterClass.doFilter(FilterClass.java:24)rnrn高手帮我看看呢rn我是用<em>spring</em>管理Hibernian和struts的rn是建立有关系的rnpublic Integer adduserinfo(final Userinfo userinfo) rn Integer num=(Integer)this.getHibernateTemplate().execute(new HibernateCallback()rn rn public Object doInHibernate(Session s)throws HibernateException,SQLExceptionrn rn return s.<em>save</em>(userinfo);rn rn );rnuserinfo包含有user的信息rnrnrn
hibernatesave问题(急)
public boolean create(TelnetPort port) throws Exception   try    Session session = this.beginTransaction();    System.out.println("port===>"+port+",session===>"+session);    session.<em>save</em>(port);       this.endTransaction(true);    catch (HibernateException e)    e.printStackTrace();    this.endTransaction(false);    // this.error("createupsconf.error:" + e);    e.printStackTrace();    return false;      return true;  n  n  n TelnetPort.hbm.xmln  n http://<em>hibernate</em>.sourceforge.net/<em>hibernate</em>-mapping-2.0.dtd">    table="TelnetPort">                length="20" />         length="11" />      length="200" />      length="200" />      length="200" />   n 为什么数据保存不到数据库中呢,并且还不抛异常,这是怎么回事呀,session有值,说明就拿到了连接,n 请那位达人帮我看看.
关于hibernatesave问题
session.<em>save</em>(college);rn LogUtil.log.info("check:will to execute tx commit :<em>save</em> college");rn System.out.println("will execute commit");rn tx.commit();rn日志:rnHibernate: insert into COLLEGE (NO, NAME) values (?, ?)rn2008/02/22 16:57:42:671 CST [INFO] LogUitl :----- - check:will to execute tx commit :<em>save</em> collegern为会么在我提交事务前,insert into COLLEGE (NO, NAME) values (?, ?)语句就出来了?rn
hibernate save
<em>save</em>()之后的其他操作可能会报错,我在<em>save</em>()加了commit 会保存成功。rn但是之后的其他操作会报错:Transaction not successfully startedrnrn有什么办法<em>save</em>()之后的其他操作报错他能<em>save</em>成功。之后的操作又不会有错。rn试了一些方法,不行。rnrn
hibernate 连续 save时候报错事务回滚
下面的<em>save</em>添加的<em>时候</em>一定要注意,上面外键相关的主键有没有,有没有id,如果下面的<em>save</em> ,不是外键,则添加进去为空,为外键,则报错,则不行 ,在service层, 如果直接在action层,则没有报错,但仍需要得到id
Hibernate save时候能自动生成表吗
rn事先还没建表,在测试<em>save</em>方法时能让<em>hibernate</em>帮我自动生成数据库表吗?rn[code=Java]rn@Entityrnpublic class Category rn private int id;rn private String name;rn rn @Idrn @GeneratedValuern public int getId() rn return id;rn rn public void setId(int id) rn this.id = id;rn rn public String getName() rn return name;rn rn public void setName(String name) rn this.name = name;rn rnrn[/code]rn下面是<em>save</em>的测试方法,通过Service层的方法rn[code=Java]rn     @Testrn public void testAdd() rn Category category = new Category();rn category.setName("c1");rn categoryService.add(category);rn rn[/code]rn连接数据库都是交给Spring容器来管理。。。。在测试以上方法时不能自动生成数据表?rnrn[code=Java]rnCaused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 't_bbs.category' doesn't existrn[/code]
spring hibernate整合的时候
错误信息好像找不到datasource类rnorg.<em>spring</em>framework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: com/mchange/v2/ser/Indirectorrn at org.<em>spring</em>framework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1105)rn at org.<em>spring</em>framework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1050)rn at org.<em>spring</em>framework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)rn at org.<em>spring</em>framework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)rn at org.<em>spring</em>framework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)rn at org.<em>spring</em>framework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)rn at org.<em>spring</em>framework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)rn at org.<em>spring</em>framework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)rn at org.<em>spring</em>framework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)rn at org.<em>spring</em>framework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:838)rn at org.<em>spring</em>framework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)rn at org.<em>spring</em>framework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)rn at org.<em>spring</em>framework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83)rn at cn.nttdata.<em>spring</em>_<em>hibernate</em>.test.SH_test.(SH_test.java:17)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)rn at java.lang.reflect.Constructor.newInstance(Unknown Source)rn at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:217)rn at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:266)rn at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)rn at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:263)rn at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)rn at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)rn at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)rn at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)rn at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)rn at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)rn at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)rn at org.junit.runners.ParentRunner.run(ParentRunner.java:363)rn at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)rn at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)rnCaused by: java.lang.NoClassDefFoundError: com/mchange/v2/ser/Indirectorrn at java.lang.Class.getDeclaredConstructors0(Native Method)rn at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)rn at java.lang.Class.getConstructor0(Unknown Source)rn at java.lang.Class.getDeclaredConstructor(Unknown Source)rn at org.<em>spring</em>framework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:80)rn at org.<em>spring</em>framework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1098)rn ... 35 morernCaused by: java.lang.ClassNotFoundException: com.mchange.v2.ser.Indirectorrn at java.net.URLClassLoader.findClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rn at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rn ... 41 morernrnapplicationcontext.xml中rn rn rn rnrn rn rn rn rn rn rn rn rn rnrnrn求教》》》》》》
hibernatesave时候发update语句
[code=java]rn SessionFactory sessionFactory=HibernateUtil.getSessionFactory();rn Session session=sessionFactory.getCurrentSession();rn Student s = new Student();rn s.setName("zt1");rn s.setPassword("111111");rn Transaction t = session.beginTransaction();rn session.<em>save</em>(s);rn //s.setName("zt3");此时只发insertrn t.commit();rn[/code]rn控制台打印:Hibernate: insert into Student (name, password) values (?, ?)rn把注释解开后rn[code=java]rn SessionFactory sessionFactory=HibernateUtil.getSessionFactory();rn Session session=sessionFactory.getCurrentSession();rn Student s = new Student();rn s.setName("zt1");rn s.setPassword("111111");rn Transaction t = session.beginTransaction();rn session.<em>save</em>(s);rn s.setName("zt3");//此时发insert后还有updatern t.commit();rn[/code]rn控制台打印:rnHibernate: insert into Student (name, password) values (?, ?)rnHibernate: update Student set name=?, password=? where id=?rn我是这么想的:一个对象在刚new出来的<em>时候</em>是Transient,<em>save</em>之后是Persistent,rncommit之后Detached。Detached时,对象跟数据库没有联系,如果对象修改,需要update,变为Persistent,这时会发update语句。rn我代码里的对象s在session还没有提交事务的<em>时候</em>修改s的name,为何还发update语句?
Struts、Spring、Hibernate集成附加(Ajax)集成
本例题<em>集成</em>了Struts、Hibernate、Spring和Ajax框架(DWR)应用,数据库用自带ExportDB类生成。绝对经典!
Spring与Hibernate集成授课代码
Spring与Hibernate<em>集成</em>授课代码 整合、封装
Struts、spring、Hibernate集成手册
介绍了Struts、<em>spring</em>、Hibernate三个框架<em>集成</em>开发的整个流程,介绍的非常详细。对于没有用过ssh框架进行过<em>集成</em>开发的人非常有用。
FLEX和springhibernate集成.rar
FLEX和<em>spring</em>、<em>hibernate</em>的<em>集成</em>.rar
spring集成hibernate事务处理问题
小弟现在想把<em>spring</em>与<em>hibernate</em><em>集成</em>到一起,在网上找了很多次资料,终于把配置文件写好,可是出现一<em>问题</em>,我如果用<em>spring</em>处理<em>hibernate</em>的事务<em>问题</em>,就会出现,比如添加一条数据后数据库里不加,但也不报错rnrn这是<em>spring</em>配置文件rnrn rn rn classpath:<em>hibernate</em>.cfg.xml rn rn rnrnrn rn rn rn rn rn rn rnrn rn rn rnrnrnrn rn rn rn rn dao.BeanDao rn rn rn rn rn rn PROPAGATION_REQUIREDrn PROPAGATION_REQUIREDrn PROPAGATION_REQUIREDrn PROPAGATION_REQUIREDrn rn rnrnrn rn truern rn rn rnrnrn我发现如果我在<em>hibernate</em>配置文件里加入一行rntruern然后<em>spring</em>配置文件里就写rnbean id="mySessionFactory"rnbean id="UsersDAO"rn这两个就可以了,就能加入数据,可是这样是不是就不是<em>spring</em>帮我管理事务了,我让<em>spring</em>帮我管理事务还是不行,也不报错rn
spring,struts2,hibernate集成实例
实现ssh的<em>集成</em>,<em>spring</em>,struts2,<em>hibernate</em>,的<em>集成</em>
集成Spring和SpringMVC和Hibernate上
将前面讲过的Spring5、SpringMVC、Hibernate5和前端框架Easyui整合起来最终完成一个基于角色和资源的权限控制模型,完全当成真实的项目来做的,能让同学们进一步的提升实战开发能力!
Hibernate和Spring集成分页方法
Hibernate和Spring<em>集成</em>分页算法,很实用的方法。
Spring集成Jpa(Hibernate实现)
Spring<em>集成</em>Jpa(Hibernate实现)例子,原代码哦~! 包涵所需要的jar包,这些jar包不好找,版本如果不兼容就会出现各种各样的莫名其妙的错误或异常。
spring,struts,hibernate集成
包含<em>spring</em>,struts,<em>hibernate</em>中所用包,其中struts包jstl.jar,standard.jar为1.1版本
struts spring hibernate 集成例子
自己写的非常好的struts <em>spring</em> <em>hibernate</em> <em>集成</em>例子 实例代码教程,含易懂源码和pdf参考
springhibernate集成 采用声明式事务
原文地址:<em>spring</em> 和<em>hibernate</em><em>集成</em> 采用声明式事务作者:雪狼首领 采用声明式事务   1、声明式事务配置 * 配置SessionFactory * 配置事务管理器 * 事务的传播特性 * 那些类那些方法使用事务   2、编写业务逻辑方法 * 继承HibernateDaoSupport类,使用HibernateTemplate来持久化,Hibernat...
spring集成hibernate,事务处理错误问题
小弟初学<em>hibernate</em>,用<em>spring</em><em>集成</em><em>hibernate</em><em>时候</em>,主动加载事务处理 ,rn出现错误,向大家请教。rnrnrn[color=red]Manager类代码:[/color]rnrn[color=red]OrgManagerImpl 继承 HibernateDaoSupportrn其中findOrg方法代码为[/color]rnpublic Organization findOrg(int orgId) rn // TODO Auto-generated method stubrn return (Organization) getHibernateTemplate().[color=red]get[/color](Organization.class,rn orgId);rn rnrn[color=red]此处get,load效果一样,都报错。[/color]rnrn[color=red]OrgManagerImpl Spring bean 配置文件 applicationContext-beans.xml[/color]rnrnrnrnrnrn rn rn rnrnrn[color=red]<em>spring</em> 事务处理 xml文件 : applicationContext-common.xml[/color]rnrnrnrnrn rn rn rn classpath:<em>hibernate</em>.cfg.xmlrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrnrnrnrn[color=red]采用 JUnit测试类 代码[/color]rnrnpublic void testFindOrg() rn OrgManager orgImpl = (OrgManager)factory.getBean("OrgManager");rn Organization org = (Organization)orgImpl.findOrg(2);rn System.out.println(org.getSn() + " parent " + org.getParent().getDescription());rn rnrnrn[color=red]报错信息:[/color]rnrn10:48:06,531 WARN ConfigurationFactory:127 - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/F:/Eclipse3.3/OA/myOa/WebRoot/WEB-INF/lib/ehcache-1.2.jar!/ehcache-failsafe.xmlrn10:48:08,421 ERROR LazyInitializationException:19 - could not initialize proxy - the owning Session was closedrnorg.<em>hibernate</em>.LazyInitializationException: could not initialize proxy - the owning Session was closedrn at org.<em>hibernate</em>.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:60)rn at org.<em>hibernate</em>.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)rn at org.<em>hibernate</em>.proxy.pojo.cglib.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:160)rn at com.ddy.oa.model.Organization$$EnhancerByCGLIB$$16ae7ba.getSn()rn at com.ddy.oa.manager.impl.OrgManagerImplTest.testFindOrg(OrgManagerImplTest.java:61)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at junit.framework.TestCase.runTest(TestCase.java:154)rn at junit.framework.TestCase.runBare(TestCase.java:127)rn at junit.framework.TestResult$1.protect(TestResult.java:106)rn at junit.framework.TestResult.runProtected(TestResult.java:124)rn at junit.framework.TestResult.run(TestResult.java:109)rn at junit.framework.TestCase.run(TestCase.java:118)rn at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)rn at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)rnrnrn已经想了好几天,还是不能够解决<em>问题</em>,向大家请教。先谢啦。rnn[b]<em>问题</em>补充:[/b]n先感谢 dmewy 的回答。rnrnOrgManagerImpl 是一个Manager类,我用它的findOrg方法来为业务逻辑来提供rnrnOrganization 的查找。不可能把业务逻辑也写倒方法里的。rnrn就是根据id 来查找 倒具体的Organization 类返回啊。rnrn[color=red]或者可以考虑open session in view 模式也可以解决。 [/color]rnrn可以请教一下 open session in view 模式 具体怎么设置嘛?
Struts2 和 Spring 、Hibernate 集成 错误
[code=Java]rn org.apache.jasper.JasperException: java.lang.ClassCastException: org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.apache.AnnotationProcessorrn org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:154)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:320)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:73)rnrnroot causernrnjava.lang.ClassCastException: org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.apache.AnnotationProcessorrn org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:144)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:320)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:73)rnrn[/code]rnrnrnrn这是什么错误啊 这是在访问 Action 的<em>时候</em>出现的 不能防访问啊
Spring与Hibernate集成中的session
Spring与Hibernate<em>集成</em>中的session.doc
三大框架集成 struts2,spring,hibernate
三大框架的<em>集成</em>,简单的应用但是很容易理解三大框架的搭建 对初学者有非常大的帮助
spring学习:hibernate orm集成
NULL 博文链接:https://shmilyaw-hotmail-com.iteye.com/blog/2201696
3dmx精细人体模型下载
这是一个3dmx的女人体的模型。非常的精细,少有的。 相关下载链接:[url=//download.csdn.net/download/aisuu55801/2060898?utm_source=bbsseo]//download.csdn.net/download/aisuu55801/2060898?utm_source=bbsseo[/url]
Navicat 8.2.12 for MySQL下载
Navicat 是卓软数码科技有限公司生产的一系列 MySQL、Oracle、SQLite、PostgreSQL 及 Microsoft SQL Server 的图形化数据库管理及发展软件。它有一个类似浏览器的图形使用者接口,支援多重连线到本地和远端数据库。它的设计乎合各种使用者的需求,从数据库管理员和程序员,到各种为客户服务并与合作伙伴共享信息的不同企业或公司。 相关下载链接:[url=//download.csdn.net/download/hitoha/4398853?utm_source=bbsseo]//download.csdn.net/download/hitoha/4398853?utm_source=bbsseo[/url]
selet-poll-epoll三种模式的简介与比较下载
selet-poll-epoll三种模式的简介与比较 相关下载链接:[url=//download.csdn.net/download/pan__/7728639?utm_source=bbsseo]//download.csdn.net/download/pan__/7728639?utm_source=bbsseo[/url]
相关热词 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池 c#5.0 安装程序 c# 分页算法 c# gmail 发邮件 c# 多层文件
我们是很有底线的