ssh2整合事务提交问题?

我再ssh2整合的时候,将hibernate的配置文件交给spring管理,在spring中没写事务,做了一个简单的添加,为什么数据库中会有数据?而将hibernate的配置文件单独管理,则添加的时候数据库没有数据,请问这是为什么?

0

1个回答

貌似我以前遇到过这个问题。

根据我的印象貌似好像是因为,
1.hibernate的配置文件交给spring管理,数据源由spring来创建,事务默认是提交的。
2.如果单独把数据源配置写在hibernate的配置文件中事务貌似不会自动提交,你试一下在hibernate的配置文件中设置默认提交。

目前能帮你的就这么多了。试一试。

0
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
ssh2整合问题+ssh2源代码下载
下载此包后加到项目的lib中 博文链接:https://wuzhaohuixy-qq-com.iteye.com/blog/711892
SSH2 事务代理问题
[code=Java]rn rn rnrn rn rn rn rn com/onionportal/orm/SystemLog.hbm.xmlrn rn rn rn rn rn rn rnrn rn org.hibernate.dialect.MySQLDialectrn rn truern rn truern rn truern rn truern rn com.googlecode.hibernate.memcached.MemcachedCacheProviderrn rn 192.168.1.110:11211rn rn quality.cache.onionPortalCachern rn truern rn rnrn rn rn rn rn rn rn rn rn rnrn rn rn rn rn rn rn rn rn PROPAGATION_REQUIRED,readOnlyrn PROPAGATION_REQUIRED,readOnlyrn PROPAGATION_REQUIRED,readOnlyrn PROPAGATION_REQUIRED,readOnlyrn PROPAGATION_REQUIRED,readOnlyrn rn PROPAGATION_REQUIREDrn rn rn rn rn rn rn rn rn rn testtransactionServicern systemHtmlServicern rn rnrnrnrnrnrnrnrnrnrnrn rn[/code]rnrn在我使用sessionFactory.getCurrentSession();时就会抛出 [color=#FF0000]No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here[/color]错误rnrn求解释这是怎么一回事 好像事务没代理进去!网上好像看到有解决办法用注解 但是我这都是配置的也不习惯用注解的方法rnopenSession是可以的 但是也有人测试过性能方面的问题链接如下rnhttp://www.iteye.com/topic/1113462 rnrn贴上类代码rn[color=#FF0000]业务逻辑类[/color]rn[code=Java]rnpublic class TesttransactionServiceimp implements TesttransactionServicernrnrn private TesttransactionDao testtransactionDao;rn rn public void Testtransaction() rn try rn testtransactionDao.save1();rn testtransactionDao.save2();rn catch (Exception e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn rn rn rn[/code]rnrn[color=#FF0000]持久化[/color]rn[code=Java]rnrnpublic class TesttransactionDaoimp implements TesttransactionDaornrn private SessionFactory sessionFactory;rn rn public Session getSession()rn return sessionFactory.getCurrentSession();rn rn rn public void save1() throws Exceptionrn Session se=this.getSession();rn SystemLog log=new SystemLog();rn log.setCreateTime("2012-07-31 00:00:00");rn log.setMessageBody("dsf");rn log.setMessageLevel(1);rn log.setStackTrace("111");rn log.setUserId(1);rn se.save(log);rn rnrn public void save2() throws Exceptionrn Session se=this.getSession();rn SystemLog log=new SystemLog();rnrn se.save(log);rn rnrn public SessionFactory getSessionFactory() rn return sessionFactory;rn rnrn public void setSessionFactory(SessionFactory sessionFactory) rn this.sessionFactory = sessionFactory;rn rnrn[/code]rnrnrn[code=Java]rn rn rn rn rn rn rn rn rn rn rn rn rn[/code]rnrnrn网上找的很多都是一样的 也没什么参考性rn有的说加上这个 threadrn但是还是得手动配置事务rn求各位大神给个解决办法!
SSH2的事务问题
把hibernate交给spring托管,在service一个方法里要保存(或其他操作比如删除,更新)两个(甚至多个)对象,如果其中任何一个操作出现异常,则全部回滚。。这其实是一个老生常谈的问题,不需要我过多描述,都能明白我的意思吧?但是我没写过。。求高人指点,最好贴代码啊大虾。。。
ssh2整合问题
先看我的配置文件:rnweb.xml:rnrnrn rn rn rn contextConfigLocationrn classpath:beans.xmlrn rn rn rn org.springframework.web.context.ContextLoaderListenerrn rn rn rn struts2rn org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilterrn rn rn struts2rn /*rn rn rn index.jsprn rnrnrnbean.xml:rnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn rn rn rn rn rn com/cn/entity/Student.hbm.xmlrn rn rn rn rn hibernate.dialect=org.hibernate.dialect.OracleDialectrn hibernate.show_sql=true hibernate.format_sql=truern rn rn rnrn rn rn rn rn rn rnrn rn rn rn rnrn rn rnrn rn rn rn rn rn rnrnrnrnstruts2.xml:rnrnrnrnrn rn rn rn rn rn rn rn /pages/list.jsprn /pages/list.jsprn rn rnrnrn
SSH2整合的问题
这些全是MyEclipse里导的rnrnspring 我是导入了Spring 2.0 AOP , Core , Persistence Core和web librariesrnrn然后hibernate导的是core和advanced support包rnrn然后struts2导的是struts core 和 struts-spring-plugin包rnrn还有另外的两个 commons-pool.jar 和 commons-dbcp.jarrnrnrn之后配置了一个web.xml文件如下rn[code=XML]rnrnrn rn rn contextConfigLocation rn /WEB-INF/classes/applicationContext.xmlrn rnrn rn rn org.springframework.web.context.ContextLoaderListenerrn rn rn rn rn index.jsprn rn rn struts2rn rn org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilterrn rn rn rn struts2rn /*rn rn rnrn[/code]rnrnrnapplicationContext.xml的文件内容如下rn[code=XML]rnrnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn User.hbm.xmlrn rn rn rn rn rn org.hibernate.dialect.MySQLDialectrn rn rn rn rnrn[/code]rnrnrn然后还有一个User.hbm.xmlrn[code=XML]rnrnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rnrnrn[/code]rnrnrn又写了一个简单的User.java文件 只有id userName 和 password rnrn然后发布运行启动Tomcat服务器的时候报错 错误信息如下文 rnrnrn
SSH2 整合问题(急)
我整合了SSH2但是用HIBERNATE去查数据的时候好像查不出来,但是eclipse能和数据库(SQL2005)连接, 找了半天不知道是哪里错了,希望有高手能帮我解决一下. 而且查询的时候eclipse里面不报异常,但是页面就报的500, 这个资源传不上去,希望有人留下联系方式,我可以发给你看看, 或者直接联系我 Q:290651745 rnrnHTTP Status 500 - rnrn-------------------------------------------------------------------------------- rnrntype Exception report rnrnmessage rnrndescription The server encountered an internal error () that prevented it from fulfilling this request. rnrnexception rnrnjava.lang.NullPointerException rnorg.lanto.l2.web.action.CompanyAction.getAllCompany(CompanyAction.java:25) rnsun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) rnsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) rnsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) rnjava.lang.reflect.Method.invoke(Method.java:597) rncom.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:440) rncom.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:279) rncom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242) rncom.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163) rncom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) rncom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) rncom.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:249) rnorg.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) rncom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) rncom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) rncom.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122) rncom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) rncom.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) rncom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) rncom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) rncom.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) rncom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) rncom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) rncom.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:148) rncom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) rnorg.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:93) rncom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) rnorg.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235) rncom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) rncom.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89) rncom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) rncom.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:128) rncom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) rnorg.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104) rncom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) rnorg.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267) rncom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) rncom.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126) rncom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) rncom.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138) rncom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) rncom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) rncom.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:148) rncom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) rnorg.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) rncom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) rncom.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:128) rncom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) rncom.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176) rncom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) rnorg.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) rnorg.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468) rnorg.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) rnrn rnrn
ssh2整合的问题
ERROR ContextLoader:204 - Context initialization failedrnorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'studentDao' defined in ServletContext resource [/WEB-INF/applicationContext-common.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.dao.StudentDao]: Constructor threw exception; nested exception is java.lang.NullPointerExceptionrnCaused by: rnorg.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.dao.StudentDao]: Constructor threw exception; nested exception is java.lang.NullPointerExceptionrnCaused by: rnjava.lang.NullPointerExceptionrn at org.springframework.orm.hibernate3.support.HibernateDaoSupport.getSession(HibernateDaoSupport.java:140)rn at com.dao.StudentDao.(StudentDao.java:17)rnat sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rn
SSH2整合问题
rn严重: Exception starting filter struts2rnjava.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=java.lang.String, name='struts.objectFactory.spring.autoWire.alwaysRespect'] in public org.apache.struts2.spring.StrutsSpringObjectFactory(java.lang.String,java.lang.String,java.lang.String,javax.servlet.ServletContext).rn at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:290)rn at com.opensymphony.xwork2.inject.ContainerImpl$2.call(ContainerImpl.java:117)rn at com.opensymphony.xwork2.inject.ContainerImpl$2.call(ContainerImpl.java:115)rn at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:542)rn at com.opensymphony.xwork2.inject.ContainerImpl.injectStatics(ContainerImpl.java:114)rn at com.opensymphony.xwork2.inject.ContainerBuilder.create(ContainerBuilder.java:494)rn at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:145)rn at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)rn at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)rn at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)rn at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:201)rn at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)rn at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)rn at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:108)rn at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3693)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4340)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)rn at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)rn at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)rn at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)rn at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)rn at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)rn at org.apache.catalina.core.StandardService.start(StandardService.java:516)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:566)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 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)rnCaused by: java.lang.RuntimeException: java.lang.RuntimeException: com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=java.lang.String, name='struts.objectFactory.spring.autoWire.alwaysRespect'] in public org.apache.struts2.spring.StrutsSpringObjectFactory(java.lang.String,java.lang.String,java.lang.String,javax.servlet.ServletContext).rn at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:136)rn at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:49)rn at com.opensymphony.xwork2.inject.ContainerImpl$ParameterInjector.inject(ContainerImpl.java:431)rn at com.opensymphony.xwork2.inject.ContainerImpl.getParameters(ContainerImpl.java:446)rn at com.opensymphony.xwork2.inject.ContainerImpl.access$000(ContainerImpl.java:48)rn at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:288)rn ... 37 morernCaused by: java.lang.RuntimeException: com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=java.lang.String, name='struts.objectFactory.spring.autoWire.alwaysRespect'] in public org.apache.struts2.spring.StrutsSpringObjectFactory(java.lang.String,java.lang.String,java.lang.String,javax.servlet.ServletContext).rn at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:464)rn at com.opensymphony.xwork2.inject.ContainerImpl$7.call(ContainerImpl.java:501)rn at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:549)rn at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:499)rn at com.opensymphony.xwork2.config.impl.LocatableFactory.create(LocatableFactory.java:32)rn at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:134)rn ... 42 morernCaused by: com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=java.lang.String, name='struts.objectFactory.spring.autoWire.alwaysRespect'] in public org.apache.struts2.spring.StrutsSpringObjectFactory(java.lang.String,java.lang.String,java.lang.String,javax.servlet.ServletContext).rn at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.(ContainerImpl.java:327)rn at com.opensymphony.xwork2.inject.ContainerImpl$5.create(ContainerImpl.java:299)rn at com.opensymphony.xwork2.inject.ContainerImpl$5.create(ContainerImpl.java:298)rn at com.opensymphony.xwork2.inject.util.ReferenceCache$CallableCreate.call(ReferenceCache.java:155)rn at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)rn at java.util.concurrent.FutureTask.run(Unknown Source)rn at com.opensymphony.xwork2.inject.util.ReferenceCache.internalCreate(ReferenceCache.java:81)rn at com.opensymphony.xwork2.inject.util.ReferenceCache.get(ReferenceCache.java:121)rn at com.opensymphony.xwork2.inject.ContainerImpl.getConstructor(ContainerImpl.java:562)rn at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:460)rn ... 47 morernCaused by: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=java.lang.String, name='struts.objectFactory.spring.autoWire.alwaysRespect'] in public org.apache.struts2.spring.StrutsSpringObjectFactory(java.lang.String,java.lang.String,java.lang.String,javax.servlet.ServletContext).rn at com.opensymphony.xwork2.inject.ContainerImpl.createParameterInjector(ContainerImpl.java:239)rn at com.opensymphony.xwork2.inject.ContainerImpl.getParametersInjectors(ContainerImpl.java:229)rn at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.(ContainerImpl.java:318)rn ... 56 morern2009-3-11 2:46:11 org.apache.catalina.core.StandardContext startrn严重: Error filterStartrn2009-3-11 2:46:11 org.apache.catalina.core.StandardContext startrn严重: Context [/ssh-1] startup failed due to previous errorsrn2009-3-11 2:46:11 org.apache.catalina.core.ApplicationContext logrn
ssh2整合jbpm4.3问题
[code=Java]rnrn信息: Initializing Spring root WebApplicationContextrn16:43:59,203 ERROR ContextLoader:215 - Context initialization failedrnorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine' defined in file [C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\ssh2jbpm4.3\WEB-INF\classes\applicationContext-DB.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [protected org.jbpm.api.ProcessEngine org.jbpm.pvm.internal.processengine.SpringHelper.createProcessEngine()] threw exception; nested exception is java.lang.AbstractMethodError: org.apache.xerces.dom.ElementNSImpl.setUserData(Ljava/lang/String;Ljava/lang/Object;Lorg/w3c/dom/UserDataHandler;)Ljava/lang/Object;rn at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:444)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:903)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:817)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)rn at java.security.AccessController.doPrivileged(Native Method)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)rn at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)rn at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)rn at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)rn at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)rn at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)rn at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:987)rn at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:909)rn at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:495)rn at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)rn at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:314)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)rn at org.apache.catalina.core.StandardService.start(StandardService.java:516)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:583)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413).....rn[/code]rnrnspring 配置rn[code=Java]rnrn 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 rn rn rn rnrn rn rn rn rn rn rn rn rn rn rnrn[/code]rn我注释掉:rn这句就不报错了;纠结了4天了..............求救!!!
ssh2整合
用框架整合后,还需要些单利么rn之前没有整合,都是自己手动写单利的。那么整合后,dao和service层还需要手动写单利吗?
SSH2整合
ssh2 整合流程 1 引入spring支持 2 myeclipse中引入hibernate支持,响应包,不需要cfg配置文件。创建sessionfactory交给spring管理 3 myeclipse db连接,逆向数据库表,并自动生成hmb文件,同时生成dao,或者自己写dao 4 修改web.xml文件,家人applicationcontext.xml文件和structs信...
ssh2的整合
近日学习了ssh2的整合,整合过程觉得蛮好玩的,所以写下这个ssh2的整合文档. 什么叫整合,在我自己看来,就是融合,先后将三个(struts2/spring/hibernate)框架配置到一个容器中,将各自的功能融合在一起。(算是自己顾名思义的一点小定义吧) 整合过程中,三个框架的整合没有先后顺序,这里先从struts2开始。 下面开始整合过程。 1.整合struts2 a.     
SSH2 整合
适合新手!初期的开发!
提交未提交的事务问题
select * from v$transactionrn这样查询出一条未提交的事务,如何把这个事务提交了?
SSH2整合问题之Hibernate 配置问题
在tomcat启动的时候报错:rn[code=Java]log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).rnlog4j:WARN Please initialize the log4j system properly.rn2010-10-27 11:34:54 org.apache.catalina.core.StandardContext listenerStartrn严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerrnorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]rnCaused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]rn at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:110)rn at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:135)rn at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.(EntityEntityModeToTuplizerMapping.java:56)rn at org.hibernate.tuple.entity.EntityMetamodel.(EntityMetamodel.java:323)rn at org.hibernate.persister.entity.AbstractEntityPersister.(AbstractEntityPersister.java:433)rn at org.hibernate.persister.entity.SingleTableEntityPersister.(SingleTableEntityPersister.java:109)rn at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)rn at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:231)rn at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1313)rn at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:805)rn at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:745)rn at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:134)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1203)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1172)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:285)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)rn at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)rn at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:189)rn at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)rn at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)rn at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)rn at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)rn at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)rn at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)rn at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)rn at org.apache.catalina.core.StandardService.start(StandardService.java:519)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:581)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)rnCaused by: java.lang.reflect.InvocationTargetExceptionrn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)rn at java.lang.reflect.Constructor.newInstance(Constructor.java:513)rn at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:107)rn ... 47 morernCaused by: java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Vrn at net.sf.cglib.core.ClassEmitter.begin_class(ClassEmitter.java:77)rn at net.sf.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:173)rn at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)rn at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)rn at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145)rn at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:117)rn at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)rn at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)rn at net.sf.cglib.proxy.Enhancer.(Enhancer.java:69)rn at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:117)rn at org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:43)rn at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:188)rn at org.hibernate.tuple.entity.AbstractEntityTuplizer.(AbstractEntityTuplizer.java:128)rn at org.hibernate.tuple.entity.PojoEntityTuplizer.(PojoEntityTuplizer.java:78)rn ... 52 more[/code]rnrn网上上说缺少一个包:javassist.jar,这可以排除。rn
SSH2整合项目,json问题
大体问题情况是这样:前端用的是easyui框架,tree的url是去后端取json数据动态拼接树,但是一个请求action,通过断点发现,连调了两次方法。rn代码如下:rnjsp:rn[code=html]rn rn rn rn rn rn[/code]rnrnstruts2配置:rn[code=text]rnrn rn rn dataListrn rn rn rn[/code]rnrn关于package sysDef:rn[code=text]rnrn rn rn rn rn rn rn rn rn rn goLogin,login rn rn rn rn rn rn rn rn /login.jsprn rn rn[/code]rnrnController:rn[code=java]rnpackage com.glsys.action;rnrnimport java.util.List;rnimport java.util.Map;rnrnimport javax.annotation.Resource;rnrnimport org.springframework.context.annotation.Scope;rnimport org.springframework.stereotype.Controller;rnrnimport com.glsys.service.TreeNodeService;rnimport com.opensymphony.xwork2.ActionSupport;rnrn@Controller @Scope("prototype")rnpublic class TreeNodeAction extends ActionSupportrnrn private static final long serialVersionUID = 1L;rn rn private List> dataList;rn rn @Resource TreeNodeService ts;rn rn public List> getDataList() rn return dataList;rn rnrn public void setDataList(List> dataList) rn this.dataList = dataList;rn rnrn public String getTreeNode()rn dataList=ts.getList();rn return SUCCESS;rn rnrn[/code]rnrnservice:rn[code=java]rnpackage com.glsys.service.impl;rnrnimport java.util.ArrayList;rnimport java.util.HashMap;rnimport java.util.List;rnimport java.util.Map;rnrnimport javax.annotation.Resource;rnrnimport org.springframework.stereotype.Service;rnrnimport com.glsys.bean.Contract;rnimport com.glsys.dao.ContractDao;rnimport com.glsys.service.TreeNodeService;rn@Servicernpublic class TreeNodeServiceImpl implements TreeNodeService rn @Resource ContractDao ctDao;rn rn List> dataList;rn @Overridern public List> getList() rn dataList=new ArrayList>();rn List ctList = ctDao.findAll();rn for(Contract ct:ctList)rn Map map=new HashMap();rn map.put("id",ct.getId());rn map.put("text",ct.getName());rn dataList.add(map);rn rn System.out.println("-------------------- "+dataList.size());rn return dataList;rn rnrnrn[/code]rnrndao:rn[code=java]rnpackage com.glsys.dao.impl;rnrnimport java.util.List;rnrnimport javax.annotation.Resource;rnrnimport org.hibernate.Query;rnimport org.hibernate.SessionFactory;rnimport org.hibernate.classic.Session;rnimport org.springframework.stereotype.Repository;rnimport org.springframework.transaction.annotation.Propagation;rnimport org.springframework.transaction.annotation.Transactional;rnrnimport com.glsys.bean.Contract;rnimport com.glsys.dao.ContractDao;rn@Repository @Transactionalrnpublic class ContractDaoImpl implements ContractDaorn @Resource SessionFactory factory;rn rn @Overridern @Transactional(propagation=Propagation.NOT_SUPPORTED)rn public List findAll() rn Session session = factory.getCurrentSession();rn Query query = session.createQuery("from Contract");rn @SuppressWarnings("unchecked")rn List ctList=query.list();rn return ctList;rn rnrnrn[/code]rnrn数据库数据:rn[img=https://img-bbs.csdn.net/upload/201504/03/1428026446_397647.png][/img]rnrnjar包:rn[img=https://img-bbs.csdn.net/upload/201504/03/1428026504_581509.png][/img]rnrn登陆后控制台打印:rn[code=text]rnDEBUG - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!rn-------------------- 2rnDEBUG - Clearing transaction synchronizationrn-------------------- 4rnDEBUG - No bean named 'org.apache.struts2.json.JSONResult' found in org.springframework.beans.factory.support.DefaultListableBeanFactory@4f5ed675: defining beans [loginAction,treeNodeAction,contractDaoImpl,userDaoImpl,logValidServiceImpl,treeNodeServiceImpl,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,dataSource,sessionFactory,txManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor]; root of factory hierarchyrnDEBUG - No bean named 'org.apache.struts2.json.JSONResult' found in org.springframework.beans.factory.support.DefaultListableBeanFactory@4f5ed675: defining beans [loginAction,treeNodeAction,contractDaoImpl,userDaoImpl,logValidServiceImpl,treeNodeServiceImpl,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,dataSource,sessionFactory,txManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor]; root of factory hierarchyrnDEBUG - Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'rnDEBUG - Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'rnDEBUG - Getting BeanInfo for class [org.apache.struts2.json.JSONResult]rnDEBUG - Getting BeanInfo for class [org.apache.struts2.json.JSONResult]rnDEBUG - Caching PropertyDescriptors for class [org.apache.struts2.json.JSONResult]rnDEBUG - Found bean property 'callbackParameter' of type [java.lang.String]rnDEBUG - Found bean property 'class' of type [java.lang.Class]rnDEBUG - Found bean property 'contentType' of type [java.lang.String]rnDEBUG - Found bean property 'defaultEncoding' of type [java.lang.String]rnDEBUG - Found bean property 'enableGZIP' of type [boolean]rnDEBUG - Found bean property 'enableSMD' of type [boolean]rnDEBUG - Found bean property 'enumAsBean' of type [boolean]rnDEBUG - Found bean property 'errorCode' of type [int]rnDEBUG - Found bean property 'excludeNullProperties' of type [boolean]rnDEBUG - Found bean property 'excludeProperties' of type [java.lang.String]rnDEBUG - Caching PropertyDescriptors for class [org.apache.struts2.json.JSONResult]rnDEBUG - Found bean property 'excludePropertiesList' of type [java.util.List]rnDEBUG - Found bean property 'callbackParameter' of type [java.lang.String]rnDEBUG - Found bean property 'ignoreHierarchy' of type [boolean]rnDEBUG - Found bean property 'class' of type [java.lang.Class]rnDEBUG - Found bean property 'ignoreInterfaces' of type [boolean]rnDEBUG - Found bean property 'includeProperties' of type [java.lang.String]rnDEBUG - Found bean property 'includePropertiesList' of type [java.util.List]rnDEBUG - Found bean property 'contentType' of type [java.lang.String]rnDEBUG - Found bean property 'noCache' of type [boolean]rnDEBUG - Found bean property 'defaultEncoding' of type [java.lang.String]rnDEBUG - Found bean property 'prefix' of type [boolean]rnDEBUG - Found bean property 'root' of type [java.lang.String]rnDEBUG - Found bean property 'statusCode' of type [int]rnDEBUG - Found bean property 'wrapPrefix' of type [java.lang.String]rnDEBUG - Found bean property 'enableGZIP' of type [boolean]rnDEBUG - Found bean property 'wrapSuffix' of type [java.lang.String]rnDEBUG - Found bean property 'enableSMD' of type [boolean]rnDEBUG - Found bean property 'wrapWithComments' of type [boolean]rnDEBUG - Found bean property 'enumAsBean' of type [boolean]rnDEBUG - Found bean property 'errorCode' of type [int]rnDEBUG - Found bean property 'excludeNullProperties' of type [boolean]rnDEBUG - Found bean property 'excludeProperties' of type [java.lang.String]rnDEBUG - Found bean property 'excludePropertiesList' of type [java.util.List]rnDEBUG - Found bean property 'ignoreHierarchy' of type [boolean]rnDEBUG - Found bean property 'ignoreInterfaces' of type [boolean]rnDEBUG - Found bean property 'includeProperties' of type [java.lang.String]rnDEBUG - Found bean property 'includePropertiesList' of type [java.util.List]rnDEBUG - Found bean property 'noCache' of type [boolean]rnDEBUG - Found bean property 'prefix' of type [boolean]rnDEBUG - Found bean property 'root' of type [java.lang.String]rnDEBUG - Found bean property 'statusCode' of type [int]rnDEBUG - Found bean property 'wrapPrefix' of type [java.lang.String]rnDEBUG - Found bean property 'wrapSuffix' of type [java.lang.String]rnDEBUG - Found bean property 'wrapWithComments' of type [boolean]rnDEBUG - [JSON]["id":1,"text":"GD23412","id":2,"text":"GD54321","id":1,"text":"GD23412","id":2,"text":"GD54321"]rnDEBUG - [JSON]["id":1,"text":"GD23412","id":2,"text":"GD54321","id":1,"text":"GD23412","id":2,"text":"GD54321"]rnDEBUG - after Locale=zh_CNrnDEBUG - intercept rnDEBUG - after Locale=zh_CNrnDEBUG - intercept rn[/code]rnrnrn[img=https://img-bbs.csdn.net/upload/201504/03/1428026752_65159.png][/img]rn
SSH2整合问题 在线等 。。。。。。。。。。。。。
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'sessionFactory' is definedrn at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:360)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:914)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:241)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)rn at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:737)rn at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.lookupSessionFactory(OpenSessionInViewFilter.java:243)rn at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.lookupSessionFactory(OpenSessionInViewFilter.java:227)rn at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:171)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)rn at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)rn at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)rn at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)rn at java.lang.Thread.run(Thread.java:619)rnrn看网上说是OpenSessionInViewFilter导致的 在web.xml 加人 rn rn rn sessionFactoryBeanName rn sessionFactory rn rnrn还是不行 求各位GG JJ 帮忙看看到底什么原因? 给小弟指条明路
ssh2事务配置管理
我使用ssh2做的,在从数据库中查询数据可以查询出来,但是对于插入,删除不起作用rn当执行插入或删除时,回报这样的错误:rnWrite operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.rnrn我在程序中写入了解决的方法如下,但是还是不好用。rnpublic boolean doAdd(Employee employee) rn this.getSession().setFlushMode(FlushMode.AUTO); rn this.getSession().save(employee); rn this.getSession().flush();rnrnrn是不是我的事务配置管理配置的不正确啊。rn我的事务配置文件如下:rnrnrn rn rn rn rnrn rn rn rn rnrn rn rn rn rn rn rn PROPAGATION_REQUIREDrn PROPAGATION_REQUIRED,readOnlyrn rn rn rn rn rn rn rn LoginServiceImplrn LoginDaoImplrn rn rn rn rn rn transactionInterceptorrn rn rn
ssh2事务demo
struts2+hibernate3+hibernate3 事务处理,采用注解方式。简单三步,即可实现事务操作
ssh2事务配置问题
[img=https://img-bbs.csdn.net/upload/201503/30/1427708705_988144.png][/img]为什么配置完事务之后旁边会有几个交换箭头
事务提交问题?
.NET中怎样实现对两个SQL SERVER数据库同时进行提交.MSDN中只有对一个数据操作成功提交例子.我要实现对两个数据库的几个表上进更新,只有两个数据库的数据同时更新成功时我才提交事务.我该怎样实现这个功能呢?谢谢
事务提交问题!
同样的一个sql 脚本:rnset xact_abort onrnbegin tranrn........rn........rncommit tran rnrnrn当用sql 2000自带的查询分析器执行后,关闭这个脚本窗口时,不会提示任何信息.rn而用sql 2005的 management studio执行后(连接sql2000的数据库),关闭脚本窗口时,提示:有未提交的事务.是否在关闭窗口之前提交这些事务?rnrn请问如何解决这个问题,让事务由脚本中的语句自动提交.
SSH事务提交问题
[code=java]rn public String saveRole(Integer app_id) throws Exception rn //先插入,比如插入了10条rn save();rn //再查询,这时查不到刚才插入的10条rn getUserRole();rn rnrn /**rn * 保存新增或修改的对象.rn */rn public void save(final T entity)rn try rn Session session = getSession();rn session.saveOrUpdate(entity);rn catch (Exception e) rn e.printStackTrace();rn rn rn[/code]rnrn[code=html]rn rn rn rn rn rn rn rn rn rn rn rn rnrnrn rnrn[/code]rn只有saveRole整个方法运行完才能再数据库查到数据。rn我知道运行saveUserRole()的时候不会插入到数据库,但是应该是存在缓存里的,执行getUserRole()是从缓存里取,为什么查不到啊?
Spring+JPA+MySQL事务提交问题
最近在做一个小系统,用到了Spring+JPA+MySQL5.0rnrn当不加入事务拦截时,程序可以正常运行,但是新增的数据没有提交到数据库中。rnrn当加入了事务控制后,程序抛异常了。rnrn具体异常信息如下:rn[code=Java]javax.persistence.RollbackException: Transaction marked as rollbackOnlyrn at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:51)rn at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:456)rn at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:732)rn at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:701)rn at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:321)rn at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)rn at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)rn at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)[/code]rnrnrn/////////////////////////////////////////////////////////////////////////////////////////////////////////rnrnSpring的配置文件如下:rnrn[code=XML]rn rn rn rn rn rn com.mysql.jdbc.Driverrn rn rn jdbc:mysql://127.0.0.1:3306/rtf_misrn rn rn rootrn rn rn rootrn rn rn 10rn rn rn 5rn rn rn 30rn rn rn 5rn rn rn 10rn rn rn 0rn 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 rn rn rn rn rn rn rn rnrn rn rn rn rn rn rn rn rn rnrn[/code]rnrnrn/////////////////////////////////////////////////////////////////////////////////////////////////////////rnpersistence.xml(该文件放在src下)rnrn[code=XML]rnrnrn rn rn org.hibernate.ejb.HibernatePersistencern rn org.gw.pojo.AssUserRolern org.gw.pojo.TbModuletreern org.gw.pojo.TbNounrn org.gw.pojo.TbNewsrn org.gw.pojo.TbRegisterrn org.gw.pojo.TbModuleresourcern org.gw.pojo.TbUserrn org.gw.pojo.TbWebrn org.gw.pojo.TbOperatern org.gw.pojo.TbRolern org.gw.pojo.TbQuestionrn org.gw.pojo.AssRoleModuletreern org.gw.pojo.TbDocumentrn org.gw.pojo.TbTeamrn org.gw.pojo.TbLinkrn org.gw.pojo.TbProductrn org.gw.pojo.TbMeetingrn org.gw.pojo.TbAttachementrn org.gw.pojo.AssOperateModuleresourcern org.gw.pojo.AssRoleModuletreeIdrn org.gw.pojo.AssUserRoleIdrn org.gw.pojo.AssOperateModuleresourceIdrn rn rn rn rn rn rn rn rn rnrnrn[/code]rnrn望各位大侠指点迷津!rnrn谢谢!rnrn(会不会是MySQL5.0本身的原因,之前网上有人说MYSQL5.0安装的时候不支持事务)
关于事务提交的问题
我用的数据库是IBrn在数据提交form里面有添加、删除、修改、确定、取消、刷新几个按钮rn在确定时会提交事务,语句是:IBTransaction.commit;rn在取消时会回滚事务,语句是:IBTransaction.Rollback;rnrn我的问题是这样的,我按了添加->确定,在这里还很正常rn但当我再按取消的时候后之前的事务居然能回滚,理论上我按了确定的话rn应该提交了事务的啦,为什么IBTransaction.Rollback依然能够执行呢?
事务提交问题
在存储过程种我们经常会用到事务的处理,一个批处理中的执行语句只要一个有出错感觉好像就全部回rnrn滚,这种情况下用begin tran与commit tran感觉起不到作用。不知道能否举个简单例子来体现下用处?
sql 事务提交问题
我现在的情况是rn向一张表A插入一条记录的同时要向表B循环插入若干条记录,这个事务要怎么写,正常事务的写法是同时分别向两表插入两条记录不成功就回滚。rn我的相当于rnsql="insert into a values(……)"rnexcuteUpdate(sql)rnrnwhile(条件)rnrnsql="insert into b values(……)"rnexcuteUpdate(sql)rnrn如果表A插入不成功,那么表B的所有记录回滚
PowerBuilder事务提交的问题
[code=C#]INT li_dw1_update,li_up1rndw_1.accepttext()rnli_dw1_update=dw_1.update(true,false)rnrninsert into sa_order select * from table_A USING fdjca;rnrnli_up1=fdjca.sqlcodernrnIF li_dw1_update=1 and li_up1=0 THENrn dw_1.ResetUpdate()rn COMMIT USING fdjca;rn messagebox("","保存成功!")rnElsern ROllback using fdjca;rn messagebox("","保存失败!")rnEND IF[/code]rnrn采用以上的方法更新以后,有时会出现数据窗口更新后,插入数据失败的情况!rn觉得思路没有问题,高手讲解一下是为什么?
分段事务提交的问题
刚进公司,领导要我研究和设计一下专门针对事务的处理方法,下面这个问题不知道怎么处理rnrn一个大事务下包含多个小事务,每个小事务都成功大事务才成功,小事务自身成功就OK,之间互不影响)rn注:此处主要是考虑事务方法的通用性问题,即有多个业务方法,都有实现事务,但有个大的业务场景需要使用到各小业务的方法,但相互之间的事务不影响,这个要怎么实现rnrn各位帮忙看看
php事务提交问题
请问现在的php5.0支持事务提交吗?我有mysqli写的程序,在提交两个插入数据时,无法回滚,怎么回事?mysql用的也是5.0的rn
事务提交问题1
alter proc lin1rnasrnbeginrnbegin tran rn exec lin2rnif @@trancount>0rnrollback tranrnendrngornalter proc lin2rnasrnbeginrn begin tranrn if 2>5 rn commit tranrn elsern beginrn rollback tran rn endrnendrngornexec lin1rnrnrn----------------------rn服务器: 消息 266,级别 16,状态 2,过程 lin2,行 65535rnEXECUTE 后的事务计数指出缺少了 COMMIT 或 ROLLBACK TRANSACTION 语句。原计数 = 1,当前计数 = 0。rn---------------------rn为什么会提示错误呢,是哪里漏了一个吗?
关于事务提交的问题?~~~~~~~~
在后台写了一个存储过程,其中内容包含在begin transaction 和commit trancation/rollback trancation中,其中在过程中有些情况判断,当不满足条件时有多处是先rollback trancation 然后 return程序,当在前台(pb)中调用时,有时候会出现当前事务记数错误问题。这种情况并不是每次操作都出现,操作一段时间就会出现了,这是怎么一会事呢,我现在把,事务去掉了,反而操作很正确,很是不理解,请给出点看法和指正~,因为我还是想用事务来控制,另外请问在事务的时候应该注意那些方面的问题呢?谢谢参与
SSH2整合示例
Struts2 Spring3 hibernate3 log4j mysql junit整合 包括配置文件 数据库建表 详细注释 内含所有依赖的jar包
ssh2整合实现CRUD
使用ssh2实现的CRUD操作。好东东,初学者可以参考该文档完成三个框剪的整合
手把手教你SSH2整合
一步一步的教你配置,并提供简单的demo,是初学者学习很好的资源
SSH2整合之structs2.1.8 jar包
SSH2整合之structs2.1.8 jar包免费下载
SSH2项目整合
欢迎下载SSH2项目整合.zip 此zip资源包含: 1.SSH2的初始配置文件; 2.SSH2的整合包(SSH2+JSON); 3.SSH2整合后的参考项目(不含包,请自行拷贝)
相关热词 c#异步发送kafka c#窗体编号 c# 操作二进制文件 c# 反射 机制 c#线程 窗体失去响应 c#角度转弧度 c# 解析gps数据 c# vs设置 语法版本 c# json含回车 c#多线程demo