atomikos jta事务异常

最近使用atomikos进行分布式事务开发,遇到以下问题:com.atomikos.datasource.ResourceException: XA resource 'ds': resume for XID '31302E3131362E3134302E3231352E746D313439373430373435373030313134323636:31302E3131362E3134302E3231352E746D353639303533' raised -9: the XA resource is currently involved in a local (non-XA) transaction。

这个异常是从一个hibernate查询中报出来的,不是每次查询都会报异常,偶尔会报,事务管理器使用的是JtaTransactionManager,基本代码如下:

 @Service("groundQuartzMonitorBiz")
@Transactional
public class QuartzMonitorBiz extends BaseBiz implements IQuartzMonitorBiz {

    private @Autowired IQuartzMonitorDao quartzMonitorDao;

    @Override
    @Transactional(readOnly = true)
    public Map<?,?> loadQuartzMonitor(String jobCode) {

        if (jobCode == null || "".equals(jobCode.trim())) {
            return null;
        }

        List<Map<?,?>> rets = quartzMonitorDao.loadQuartzMonitor(jobCode);
        if (null == rets || rets.isEmpty()) {
            return null;
        }
        return rets.iterator().next();
    }
}
 @Repository("groundQuartzMonitorDao")
public class QuartzMonitorDao extends CommonDao implements IQuartzMonitorDao {

    @Override
    @SuppressWarnings("unchecked")
    public List<Map<?, ?>> loadQuartzMonitor(String jobCode) {
        Query query = this.getCurrentSession().createSQLQuery(
                select id,job_code,startup_flg,cron_expression_flg,cron_expression,comments from ts_quartz_monitor t where t.job_code=:jobcode);
        query.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
        query.setString("jobcode", jobCode);
        return query.list();
    }
}

哪位大神遇到过这种情况的请分享一下,不胜感激。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
SSH 中 用了atomikos集成JTA 事务后,hibernate执行任何操作失败后都不抛异常
在项目中, 用了atomikos集成JTA 事务后,hibernate执行任何操作失败后都不抛异常 比如,我用getHibernateTemplate().load方法加载一个不存在的数据都不抛出异常,或者我删除一个不存在的记录也不抛异常,谁知道这是什么原因啊??????????
SSH 中 atomikos集成JTA 事务无法回滚
applicationContext.xml配置文件如下 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"> <bean id="dataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean" init-method="init" destroy-method="close"> <description>oracle xa datasource</description> <property name="uniqueResourceName"> <value>oracle1</value> </property> <property name="xaDataSourceClassName"> <value>oracle.jdbc.xa.client.OracleXADataSource</value> </property> <property name="xaProperties"> <props> <prop key="user">test</prop> <prop key="password">test</prop> <prop key="URL">jdbc:oracle:thin:@192.168.0.28:1521:test</prop> </props> </property> </bean> <bean id="dataSourceOracle" class="com.atomikos.jdbc.AtomikosDataSourceBean" init-method="init" destroy-method="close"> <property name="uniqueResourceName"> <value>oracle2</value> </property> <property name="xaDataSourceClassName"> <value>oracle.jdbc.xa.client.OracleXADataSource</value> </property> <property name="xaProperties"> <props> <prop key="user">test1</prop> <prop key="password">test1</prop> <prop key="URL">jdbc:oracle:thin:@192.168.0.28:1521:test</prop> </props> </property> </bean> <bean id="sessionFactory1" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.Oracle9Dialect </prop> <prop key="hibernate .show_sql">true</prop> <prop key="hibernate.max_fetch_depth">1</prop> <prop key="hibernate.jdbc.fetch_size">20</prop> <prop key="hibernate.query.factory_class"> org.hibernate.hql.ast.ASTQueryTranslatorFactory </prop> </props> </property> <property name="jtaTransactionManager" ref="atomikosTransactionManager" /> <property name="mappingDirectoryLocations"> <list> <value> classpath*:com/yappam/model/ </value> </list> </property> </bean> <bean id="sessionFactory2" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSourceOracle" /> </property> <property name="hibernateProperties"> <props>[b][/b] <prop key="hibernate.dialect"> org.hibernate.dialect.Oracle9Dialect </prop> <prop key="hibernate .show_sql">true</prop> <prop key="hibernate.max_fetch_depth">1</prop> <prop key="hibernate.jdbc.fetch_size">20</prop> <prop key="hibernate.query.factory_class"> org.hibernate.hql.ast.ASTQueryTranslatorFactory </prop> </props> </property> <property name="jtaTransactionManager" ref="atomikosTransactionManager" /> <property name="mappingLocations"> <list> <value> classpath*:com/yappam/model/oracle/*.hbm.xml </value> </list> </property> </bean> <bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager" init-method="init" destroy-method="close"> <property name="forceShutdown"> <value>true</value> </property> </bean> <bean id="txManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="userTransaction" ref="atomikosUserTransaction" /> <property name="transactionManager" ref="atomikosTransactionManager"> </property> </bean> <bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp"> <property name="transactionTimeout"> <value>240</value> </property> </bean> <tx:advice id="txAdvice" transaction-manager="txManager"> <tx:attributes> <tx:method name="save*" propagation="REQUIRED" rollback-for="Exception" /> <tx:method name="delete*" propagation="REQUIRED" rollback-for="Exception" /> <tx:method name="update*" propagation="REQUIRED" rollback-for="Exception" /> <tx:method name="*" propagation="REQUIRED" /> </tx:attributes> </tx:advice> <aop:config proxy-target-class="true"> <aop:pointcut id="iPointCuts" expression="execution(* com.yappam.service.impl..*(..))" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="iPointCuts" /> </aop:config> </beans> 如果将事务的隔离界别设置成 read-only="true",则两个数据库都才、不能插入数据, 但是我现在 User user=new User(); user.setId("0000000000128359568004600001372");//不存在数据 userDao.delete(user); Test t=new Test(); t.setId(IDGenerator.getId()); t.setUsername("222"); testDao.save(t); 我先删除一条不存在信息抛出异常,但是事务却不回滚,任然可以有一个数据库插入成功? 请大家帮忙解决下!谢谢
springboot+jpa+jta-atomikos多数据源事务异常
springboot + jpa配置jta事务,出现第一个数据源可以正常使用,但第二个只能查询,不能CRUD操作,求大神指点 第一个数据源如下: @Configuration @EnableTransactionManagement @EnableJpaRepositories(basePackages = "com.saxon.primary.dao", entityManagerFactoryRef = "primaryEntityManagerFactory", transactionManagerRef = "jtaTransactionManager") public class PrimaryDataSourceConfig { @Bean @Primary @ConfigurationProperties("spring.primary.datasource") public DataSourceProperties primaryProperties(){ return new DataSourceProperties(); } @Bean @Primary @ConfigurationProperties("spring.primary.datasource") public DataSource primaryDataSource(){ return primaryProperties().initializeDataSourceBuilder().build(); } @Bean @Primary public LocalContainerEntityManagerFactoryBean primaryEntityManagerFactory(EntityManagerFactoryBuilder builder){ return builder .dataSource(primaryDataSource()) .persistenceUnit("primary") .packages("com.saxon.primary.entity") .build(); } } 第二个数据源: @Configuration @EnableTransactionManagement @EnableJpaRepositories(basePackages = "com.saxon.others.dao", entityManagerFactoryRef = "othersEntityManagerFactory", transactionManagerRef = "jtaTransactionManager") public class OthersDataSourceConfig { @Bean @ConfigurationProperties("spring.others.datasource") public DataSourceProperties othersProperties(){ return new DataSourceProperties(); } @Bean @ConfigurationProperties("spring.others.datasource") public DataSource othersDataSource(){ return othersProperties().initializeDataSourceBuilder().build(); } @Bean public LocalContainerEntityManagerFactoryBean othersEntityManagerFactory(EntityManagerFactoryBuilder builder){ return builder .dataSource(othersDataSource()) .persistenceUnit("others") .packages("com.saxon.others.entity") .build(); } } jta事务配置: @Configuration @EnableTransactionManagement public class TransactionManagerConfig { @Bean(destroyMethod = "close", initMethod = "init") public UserTransactionManager userTransactionManager() { UserTransactionManager userTransactionManager = new UserTransactionManager(); userTransactionManager.setForceShutdown(false); return userTransactionManager; } public @Bean UserTransaction userTransaction() throws Throwable { UserTransactionImp userTransactionImp = new UserTransactionImp(); userTransactionImp.setTransactionTimeout(300); return userTransactionImp; } public @Bean PlatformTransactionManager jtaTransactionManager() throws Throwable { JtaTransactionManager jtaTransactionManager = new JtaTransactionManager(); jtaTransactionManager.setTransactionManager(userTransactionManager()); jtaTransactionManager.setUserTransaction(userTransaction()); return jtaTransactionManager; } } 但执行第二个数据源的crud操作,报如下异常: 2017-07-20 18:00:43.131 ERROR 46084 --- [nio-9008-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: no transaction is in progress; nested exception is javax.persistence.TransactionRequiredException: no transaction is in progress] with root cause javax.persistence.TransactionRequiredException: no transaction is in progress at org.hibernate.jpa.spi.AbstractEntityManagerImpl.checkTransactionNeeded(AbstractEntityManagerImpl.java:1136) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.jpa.spi.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:1297) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121] at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:347) ~[spring-orm-4.3.9.RELEASE.jar:4.3.9.RELEASE] at com.sun.proxy.$Proxy76.flush(Unknown Source) ~[na:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
关于Java使用atomikos分布式事务问题
使用的ssm框架,管理事务出现异常: XML事务配置如下: <!-- 分布式事务 --> <bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager" init-method="init" destroy-method="close"> <property name="forceShutdown" value="true"/> </bean> <bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp"> <property name="transactionTimeout" value="3"/> </bean> <!-- JTA事务管理器 --> <bean id="springTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="transactionManager" ref="atomikosTransactionManager"/> <property name="userTransaction" ref="atomikosUserTransaction"/> </bean> <!-- 基于注解的声明式事务 --> <tx:annotation-driven transaction-manager="springTransactionManager" /> tomcat一启动时,报 com.atomikos.icatch.jta.UserTransactionManager类找不到, 如果采用单元测试,分布式事务能正常使用。 听别人说tomcat好像不支持JTA管理,请问下tomcat该怎么配置?
多数据源配置与JTA事务问题
项目中使用两个dataSourc,两个sessionFactory.由于业务变化,需要在项目中切换数据源,单独配置多数据源以及单独配置JTA都能成功,将多数据与JTA整合之后,项目启动总是抛出异常。 异常如下: ``` org.springframework.transaction.IllegalTransactionStateException: Pre-bound JDBC Connection found! HibernateTransactionManager does not support running within DataSourceTransactionManager if told to manage the DataSource itself. It is recommended to use a single HibernateTransactionManager for all transactions on a single DataSource, no matter whether Hibernate or JDBC access. ``` 网上说是jdbc的事务与hibernate的事务起冲突了,但没有找到解决办法,求大神指点。 ``` 1 <!-- atomikos事务管理器 --> 2 <bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager" 3 init-method="init" destroy-method="close"> 4 <description>UserTransactionManager</description> 5 <property name="forceShutdown"><value>true</value></property> 6 </bean> 7 8 <bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp"> 9 <property name="transactionTimeout" value="300" /> 10 </bean> 11 12 <!-- spring 事务管理器 --> 13 <bean id="springTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> 14 <property name="transactionManager" ref="atomikosTransactionManager"/> 15 <property name="userTransaction" ref="atomikosUserTransaction"/> 16 </bean> ``` AOP配置: ``` 1 <aop:aspectj-autoproxy /> 2 <aop:config proxy-target-class="true"> 3 <aop:advisor pointcut="execution(* com.animoor.m2.application..*.*(..))" advice-ref="txAdvice" /> 4 </aop:config> 5 6 <tx:advice id="txAdvice" transaction-manager="springTransactionManager"> 7 <tx:attributes> 8 <tx:method name="get*" read-only="true" /> 9 <tx:method name="find*" read-only="true" /> 10 <tx:method name="insert*" propagation="REQUIRED"/> 11 <tx:method name="update*" propagation="REQUIRED" /> 12 <tx:method name="add*" propagation="REQUIRED" /> 13 <tx:method name="delete*" propagation="REQUIRED" /> 14 <tx:method name="update*" propagation="REQUIRED" /> 15 16 <tx:method name="save*" propagation="REQUIRED" /> 17 <tx:method name="do*" propagation="REQUIRED" /> 18 .... 19 </tx:attributes> 20 </tx:advice> ``` 加入多数据源配置: ``` 1 <bean id="multipleDataSource" class="com.animoor.m2.sys.MultipleDataSource"> 2 <property name="defaultTargetDataSource" ref="dataSourceMes129"/> 3 <property name="targetDataSources"> 4 <map key-type="java.lang.String"> 5 <!--注意这里的value是和上面的DataSource的id对应,key要和下面的CustomerContextHolder中的常量对应 --> 6 <entry key="dataSourceMes129" value-ref="dataSourceMes129" /> 7 <entry key="dataSourceFgms129" value-ref="dataSourceFgms129"/> 8 <entry key="dataSourceMes168" value-ref="dataSourceMes168" /> 9 <entry key="dataSourceFgms168" value-ref="dataSourceFgms168"/> 10 </map> 11 </property> 12 </bean> ``` 项目加载时调用的方法含get*,find*,将这些get去掉则不会抛出异常,但是去掉之后事务应该没有作用了吧。 请各位大神指点 谢谢 小弟没有金币悬赏,谢谢各位了。
spring + hibernate +jta 事务不能回滚问题
由于在项目中 用到分布式事务 引用 http://momoko8443.iteye.com/blog/190994 的帖子 按照上面的配置事务不能回滚 ,对于单个数据库也是一样 问题困扰了我三天了 每天晚上查资料查到晚上3点,求各位帮帮我,先谢了 代码及其配置 如下 配置文件 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlnssi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean id="idcJDBC" class="com.atomikos.jdbc.SimpleDataSourceBean"> <property name="uniqueResourceName"><value>db_idcbase</value></property> <property name="xaDataSourceClassName"><value>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</value></property> <property name="xaDataSourceProperties"> <value>URL=jdbc:mysql://127.0.0.1:3306/db_idcbase?useUnicode=true&characterEncoding=gb2312;user=root;password=admin</value> </property> <property name="exclusiveConnectionMode"><value>true</value></property> <property name="connectionPoolSize"><value>3</value></property> <property name="validatingQuery"><value>SELECT 1</value></property> </bean> <!--sessionFactoryIdc --> <bean id="sessionFactoryIdc" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="idcJDBC" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="hibernate.show_sql">true</prop> </props> </property> <property name="mappingResources"> <list> <value> com/yiwei/hibernate/bean/TblReportHosts.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblRuleUrls.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblRuleIps.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblRuleTcps.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblRuleUdps.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblReportUrls.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblReportKeys.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblReportTcps.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblReportUdps.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblRuleKeys.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblReportProbes.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblReportVhosts.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblRuleConfs.hbm.xml </value> <value> com/yiwei/hibernate/bean/TblRuleType.hbm.xml </value> </list> </property></bean> <!--isp鏁版嵁搴? --> <bean id="ispJDBC" class="com.atomikos.jdbc.SimpleDataSourceBean"> <property name="uniqueResourceName"><value>isp</value></property> <property name="xaDataSourceClassName"><value>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</value></property> <property name="xaDataSourceProperties"> <value>URL=jdbc:mysql://127.0.0.1:3306/isp?useUnicode=true&characterEncoding=gb2312;user=root;password=admin</value> </property> <property name="exclusiveConnectionMode"><value>true</value></property> <property name="connectionPoolSize"><value>3</value></property> <property name="validatingQuery"><value>SELECT 1</value></property> </bean> <bean id="sessionFactoryIsp" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="ispJDBC"/> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="hibernate.show_sql">true</prop> </props> </property> <property name="mappingResources"> <list> <value> com/yiwei/hibernate/bean/Carrier.hbm.xml </value> <value> com/yiwei/hibernate/bean/UbietyDrawer.hbm.xml </value> <value>com/yiwei/hibernate/bean/UbietyRoom.hbm.xml</value> <value>com/yiwei/hibernate/bean/User.hbm.xml</value> <value>com/yiwei/hibernate/bean/Host.hbm.xml</value> <value>com/yiwei/hibernate/bean/Proxyer.hbm.xml</value> <value>com/yiwei/hibernate/bean/Region.hbm.xml</value> <value>com/yiwei/hibernate/bean/Role.hbm.xml</value> <value> com/yiwei/hibernate/bean/SysPrincipal.hbm.xml </value> <value> com/yiwei/hibernate/bean/SysRolePrincipal.hbm.xml </value> <value> com/yiwei/hibernate/bean/SysUserRole.hbm.xml </value> <value>com/yiwei/hibernate/bean/Log.hbm.xml</value> <value>com/yiwei/hibernate/bean/Vhost.hbm.xml</value> <value>com/yiwei/hibernate/bean/TblProxyerService.hbm.xml</value> </list> </property></bean> <!-- jta事务 --> <bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager" init-method="init" destroy-method="close"> <property name="forceShutdown"><value>true</value></property> </bean> <bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp"> <property name="transactionTimeout"><value>300</value></property> </bean> <bean id="hibernateTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="transactionManager"> <ref local="atomikosTransactionManager"/> </property> <property name="userTransaction"> <ref local="atomikosUserTransaction"/> </property> </bean> <!-- IspDAO <bean id="IspDAO" class="com.yiwei.hibernate.bean.TblIspDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryPsb" /> </property> </bean> <bean id="ispServiceTarget" class="com.yiwei.business.service.IspServiceImp"> <property name="ispDAO"> <ref bean="IspDAO"/> </property> </bean> <bean id="ispService" parent="Psb.baseTxProxy"> <property name="target"> <ref bean="ispServiceTarget"/> </property> </bean> --> <!-- UbietyRoomDAO --> <bean id="UbietyRoomDAO" class="com.yiwei.hibernate.bean.UbietyRoomDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIsp" /> </property> </bean> <bean id="ubietyRoomTarget" class="com.yiwei.business.service.UbietyRoomServiceImp"> <property name="ubietyRoomDAO"> <ref bean="UbietyRoomDAO" /> </property> </bean> <bean id="ubietyRoomService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="ubietyRoomTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED </prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- UbietyDrawerDAO --> <bean id="UbietyDrawerDAO" class="com.yiwei.hibernate.bean.UbietyDrawerDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIsp" /> </property> </bean> <bean id="ubietyDrawerTarget" class="com.yiwei.business.service.UbietyDrawerServiceImp"> <property name="ubietyDrawerDAO"> <ref bean="UbietyDrawerDAO" /> </property> </bean> <bean id="ubietyDrawerService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="ubietyDrawerTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- CarrierDAO --> <bean id="CarrierDAO" class="com.yiwei.hibernate.bean.CarrierDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIsp" /> </property> </bean> <bean id="carrierServiceTarget" class="com.yiwei.business.service.CarrierServiceImp"> <property name="carrierDAO"> <ref bean="CarrierDAO" /> </property> </bean> <bean id="carrierService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="carrierServiceTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- HostDAO --> <bean id="HostDAO" class="com.yiwei.hibernate.bean.HostDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIsp" /> </property> </bean> <bean id="hostServiceTarget" class="com.yiwei.business.service.HostServiceImp"> <property name="hostDAO"> <ref bean="HostDAO" /> </property> <property name="reportHostsDAO"> <ref bean="TblReportHostsDAO" /> </property> <property name="ubietyRoomDAO"> <ref bean="UbietyRoomDAO" /> </property> <property name="ubietyDrawerDAO"> <ref bean="UbietyDrawerDAO" /> </property> <property name="proxyerDAO"> <ref bean="ProxyerDAO" /> </property> </bean> <bean id="hostService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="hostServiceTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- UserDAO --> <bean id="UserDAO" class="com.yiwei.hibernate.bean.UserDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIsp" /> </property> </bean> <bean id="userServiceTarget" class="com.yiwei.business.service.UserServiceImp"> <property name="userDAO"> <ref bean="UserDAO" /> </property> <property name="sysPrincipalDAO"> <ref bean="SysPrincipalDAO" /> </property> <property name="sysRolePrincipalDAO"> <ref bean="SysRolePrincipalDAO" /> </property> </bean> <bean id="userService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="userServiceTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- TblReportHostsDAO --> <bean id="TblReportHostsDAO" class="com.yiwei.hibernate.bean.TblReportHostsDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIdc" /> </property> </bean> <bean id="reportHostsServiceTarget" class="com.yiwei.business.service.ReportHostsServiceImp"> <property name="reportHostsDAO"> <ref bean="TblReportHostsDAO" /> </property> </bean> <bean id="reportHostsService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="reportHostsServiceTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- ProxyerDAO --> <bean id="ProxyerDAO" class="com.yiwei.hibernate.bean.ProxyerDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIsp" /> </property> </bean> <bean id="proxyerServiceTarget" class="com.yiwei.business.service.ProxyerServiceImp"> <property name="proxyerDAO"> <ref bean="ProxyerDAO" /> </property> </bean> <bean id="proxyerService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="proxyerServiceTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- RegionDAO --> <bean id="RegionDAO" class="com.yiwei.hibernate.bean.RegionDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIsp" /> </property> </bean> <!-- TblRuleUrlsDAO --> <bean id="TblRuleUrlsDAO" class="com.yiwei.hibernate.bean.TblRuleUrlsDAO"> <property name="sessionFactory"> <ref local="sessionFactoryIdc" /> </property> </bean> <bean id="ruleUrlsServiceTarget" class="com.yiwei.business.service.RuleUrlsServiceImp"> <property name="logDAO"> <ref local="LogDAO" /> </property> <property name="ruleConfsDAO"> <ref local="TblRuleConfsDAO" /> </property> <property name="ruleUrlsDAO"> <ref local="TblRuleUrlsDAO" /> </property> </bean> <bean id="ruleUrlsService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"> <ref local="hibernateTransactionManager"/> </property> <property name="target"> <ref local="ruleUrlsServiceTarget"/> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- <bean id="ruleUrlsService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="ruleUrlsServiceTarget" /> </property> </bean> TblRuleIpsDAO --> <bean id="TblRuleIpsDAO" class="com.yiwei.hibernate.bean.TblRuleIpsDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIdc" /> </property> </bean> <bean id="ruleIpsServiceTarget" class="com.yiwei.business.service.RuleIpsServiceImp"> <property name="ruleIpsDAO"> <ref bean="TblRuleIpsDAO" /> </property> <property name="logDAO"> <ref bean="LogDAO" /> </property> <property name="ruleConfsDAO"> <ref bean="TblRuleConfsDAO" /> </property> </bean> <bean id="ruleIpsService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="ruleIpsServiceTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- TblRuleTcpsDAO --> <bean id="TblRuleTcpsDAO" class="com.yiwei.hibernate.bean.TblRuleTcpsDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIdc" /> </property> </bean> <bean id="ruleTcpsServiceTarget" class="com.yiwei.business.service.RuleTcpsServiceImp"> <property name="ruleTcpsDAO"> <ref bean="TblRuleTcpsDAO" /> </property> <property name="logDAO"> <ref bean="LogDAO" /> </property> <property name="ruleConfsDAO"> <ref bean="TblRuleConfsDAO" /> </property> </bean> <bean id="ruleTcpsService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="ruleTcpsServiceTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- TblRuleUdpsDAO --> <bean id="TblRuleUdpsDAO" class="com.yiwei.hibernate.bean.TblRuleUdpsDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIdc" /> </property> </bean> <bean id="ruleUdpsServiceTarget" class="com.yiwei.business.service.RuleUdpsServiceImp"> <property name="ruleUdpsDAO"> <ref bean="TblRuleUdpsDAO" /> </property> </bean> <bean id="ruleUdpsService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="ruleUdpsServiceTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- TblReportUrlsDAO --> <bean id="TblReportUrlsDAO" class="com.yiwei.hibernate.bean.TblReportUrlsDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIdc"></ref> </property> </bean> <bean id="reportUrlsServiceTarget" class="com.yiwei.business.service.ReportUrlsServiceImp"> <property name="reportUrlsDAO"> <ref bean="TblReportUrlsDAO" /> </property> </bean> <bean id="reportUrlsService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="reportUrlsServiceTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- TblReportKeysDAO --> <bean id="TblReportKeysDAO" class="com.yiwei.hibernate.bean.TblReportKeysDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIdc" /> </property> </bean> <bean id="reportKeysServiceTarget" class="com.yiwei.business.service.ReportKeysServiceImp"> <property name="reportKeysDAO"> <ref bean="TblReportKeysDAO" /> </property> </bean> <bean id="reportKeysService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="reportKeysServiceTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- RoleDAO --> <bean id="RoleDAO" class="com.yiwei.hibernate.bean.RoleDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIsp"></ref> </property> </bean> <bean id="roleServiceTarget" class="com.yiwei.business.service.RoleServiceImp"> <property name="roleDAO"> <ref bean="RoleDAO" /> </property> </bean> <bean id="roleService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="roleServiceTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- TblReportTcpsDAO --> <bean id="TblReportTcpsDAO" class="com.yiwei.hibernate.bean.TblReportTcpsDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIdc" /> </property> </bean> <bean id="reportTcpsServiceTarget" class="com.yiwei.business.service.ReportTcpsServiceImp"> <property name="reportTcpsDAO"> <ref bean="TblReportTcpsDAO" /> </property> </bean> <bean id="reportTcpsService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="reportTcpsServiceTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- TblReportUdpsDAO --> <bean id="TblReportUdpsDAO" class="com.yiwei.hibernate.bean.TblReportUdpsDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIdc" /> </property> </bean> <bean id="reportUdpsServiceTarget" class="com.yiwei.business.service.ReportUdpsServiceImp"> <property name="reportUdpsDAO"> <ref bean="TblReportUdpsDAO" /> </property> </bean> <bean id="reportUdpsService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="reportUdpsServiceTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- SysPrincipalDAO --> <bean id="SysPrincipalDAO" class="com.yiwei.hibernate.bean.SysPrincipalDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIsp"></ref> </property> </bean> <bean id="sysPrincipalServiceTarget" class="com.yiwei.business.service.SysPrincipalServiceImp"> <property name="sysPrincipalDAO"> <ref bean="SysPrincipalDAO" /> </property> </bean> <bean id="sysPrincipalService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="sysPrincipalServiceTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- TblRuleKeysDAO --> <bean id="TblRuleKeysDAO" class="com.yiwei.hibernate.bean.TblRuleKeysDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIdc"></ref> </property> </bean> <bean id="ruleKeysServiceTarget" class="com.yiwei.business.service.RuleKeysServiceImp"> <property name="ruleKeysDAO"> <ref bean="TblRuleKeysDAO" /> </property> <property name="logDAO"> <ref bean="LogDAO" /> </property> <property name="ruleConfsDAO"> <ref bean="TblRuleConfsDAO" /> </property> </bean> <bean id="ruleKeysService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="ruleKeysServiceTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- TblReportProbesDAO --> <bean id="TblReportProbesDAO" class="com.yiwei.hibernate.bean.TblReportProbesDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIdc"></ref> </property> </bean> <bean id="reportProbesServiceTarget" class="com.yiwei.business.service.ReportProbesServiceImp"> <property name="reportProbesDAO"> <ref bean="TblReportProbesDAO" /> </property> </bean> <bean id="reportProbesService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="reportProbesServiceTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- SysRolePrincipalDAO --> <bean id="SysRolePrincipalDAO" class="com.yiwei.hibernate.bean.SysRolePrincipalDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIsp" /> </property> </bean> <bean id="rolePrincipalServiceTarget" class="com.yiwei.business.service.SysRolePrincipalServiceImp"> <property name="sysRolePrincipalDAO"> <ref bean="SysRolePrincipalDAO" /> </property> </bean> <bean id="rolePrincipalService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="rolePrincipalServiceTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- SysUserRoleDAO --> <bean id="SysUserRoleDAO" class="com.yiwei.hibernate.bean.SysUserRoleDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIsp" /> </property> </bean> <!-- TblReportVhostsDAO --> <bean id="TblReportVhostsDAO" class="com.yiwei.hibernate.bean.TblReportVhostsDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIdc" /> </property> </bean> <bean id="reportVHostServiceTarget" class="com.yiwei.business.service.ReportVHostServiceImp"> <property name="reportVhostsHostDAO"> <ref bean="TblReportVhostsDAO" /> </property> </bean> <bean id="reportVHostService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="reportVHostServiceTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- TblRuleConfsDAO --> <bean id="TblRuleConfsDAO" class="com.yiwei.hibernate.bean.TblRuleConfsDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIdc" /> </property> </bean> <bean id="ruleConfsServiceTarget" class="com.yiwei.business.service.RuleConfsServiceImp"> <property name="ruleConfsDAO"> <ref bean="TblRuleConfsDAO" /> </property> </bean> <bean id="ruleConfsService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="ruleConfsServiceTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <bean id="LogDAO" class="com.yiwei.hibernate.bean.LogDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIsp"></ref> </property> </bean> <bean id="logServiceTarget" class="com.yiwei.business.service.LogServiceImp"> <property name="logDAO"> <ref bean="LogDAO" /> </property> </bean> <bean id="logService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="logServiceTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <bean id="TblRuleTypeDAO" class="com.yiwei.hibernate.bean.TblRuleTypeDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIdc" /> </property> </bean> <bean id="ruleTypeServiceTarget" class="com.yiwei.business.service.RuleTypeServiceImp"> <property name="ruleTypeDAO"> <ref bean="TblRuleTypeDAO" /> </property> </bean> <bean id="ruleTypeService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="ruleTypeServiceTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <bean id="HqlDAO" class="com.yiwei.hibernate.bean.HqlDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIdc" /> </property> </bean> <bean id="hqlServiceTarget" class="com.yiwei.business.service.HqlServiceImp"> <property name="hqlDao"> <ref bean="HqlDAO" /> </property> </bean> <bean id="hqlService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="hqlServiceTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <bean id="VhostDAO" class="com.yiwei.hibernate.bean.VhostDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryIsp"></ref> </property> </bean> <bean id="vhostServiceTarget" class="com.yiwei.business.service.VHostServiceImp"> <property name="vhostDAO"> <ref bean="VhostDAO"></ref> </property> </bean> <bean id="vhostService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <ref bean="vhostServiceTarget" /> </property> <property name="transactionAttributes"> <props> <prop key="get*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="find*"> PROPAGATION_REQUIRED,readOnly,-Exception </prop> <prop key="insert*">PROPAGATION_REQUIRED</prop><prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="update">PROPAGATION_REQUIRED</prop> <prop key="attachDirty">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- <bean id="TblIspDAO" class="com.yiwei.hibernate.bean.TblIspDAO"> <property name="sessionFactory"> <ref bean="sessionFactoryPsb" /> </property> </bean>--></beans> /** dao public class TblRuleUrlsDAO extends HibernateDaoSupport implements IRuleUrlsDAO public void save(TblRuleUrls transientInstance) { log.debug("saving TblRuleUrls instance"); try { getHibernateTemplate().save(transientInstance); log.debug("save successful"); } catch (DataAccessException re) { log.error("save failed", re); throw re; } } /** dao class LogDAO extends HibernateDaoSupport implements ILogDAO{ public void save(Log transientInstance) { log.debug("saving Log instance"); try { getHibernateTemplate().save(transientInstance); log.debug("save successful"); } catch (DataAccessException re) { log.error("save failed", re); throw re; } } /** service public class RuleUrlsServiceImp implements IRuleUrlsService { private IRuleUrlsDAO ruleUrlsDAO; private IRuleConfsDAO ruleConfsDAO; private ILogDAO logDAO; public IRuleUrlsDAO getRuleUrlsDAO() { return ruleUrlsDAO; } public void setRuleUrlsDAO(IRuleUrlsDAO ruleUrlsDAO) { this.ruleUrlsDAO = ruleUrlsDAO; } public void delete(TblRuleUrls persistentInstance) { // TODO Auto-generated method stub this.ruleUrlsDAO.delete(persistentInstance); } public TblRuleUrls findById(Integer id) { // TODO Auto-generated method stub return this.ruleUrlsDAO.findById(id); } public void insertUser(TblRuleUrls transientInstance,User u) { // TODO Auto-generated method stub try{ this.ruleUrlsDAO.save(transientInstance); Log log = new Log(); log.setCarrierId(transientInstance.getIspID()); log.setDtime(transientInstance.getDtime()); log.setProxyerId(transientInstance.getProxyId()); String ip = transientInstance.getAssignIp().split(" ")[0]; log.setIp(ip); log.setMessage("用户  部署了url规则 "+transientInstance.getHurl()); log.setUser(u); log.setDtime("zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"); //ILogService logService = (ILogService)AppContext.getInstance().getAppContext().getBean("logService"); logDAO.save(log); } catch(DataAccessException e){ System.err.println("service 抛出异常"); throw e; } } action */ public ActionForward ruleUrlsAdd(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { RuleUrlsForm ruleUrlsForm = (RuleUrlsForm) form;// TODO Auto-generated // method stub try{ User u = (User) request.getSession().getAttribute("u"); TblRuleUrls url = new TblRuleUrls(); PropertyUtils.copyProperties(url, ruleUrlsForm); url.setAction(ruleUrlsForm.getAct()); url.setAssignIp(request.getRemoteAddr() + " " + u.getRealName()); url.setDtime(Conversion.getDate(new Date())); String hurl = ruleUrlsForm.getHurl(); if (ruleUrlsForm.getAct().equals("redi")||ruleUrlsForm.getAct().equals("rredi")) { hurl = hurl + " " + ruleUrlsForm.getThurl(); } url.setHurl(hurl); url.setUserID(u.getId()); url.setIspID(u.getCarrierId()); url.setProxyId(u.getProxyerId()); this.getRuleUrlsService().insertUser(url,u); }catch(DataAccessException e) { System.err.println("action 执行中发生异常"); } ActionForward f = new ActionForward("ruleUrls.do?action=ruleUrlsList", true); return f; } jta 配置文件如下 c om.atomikos.icatch.service = com.atomikos.icatch.standalone.UserTransactionServiceFactory com.atomikos.icatch.enable_logging = false com.atomikos.icatch.automatic_resource_registration = true 再次谢过 查了资料后 现将每个都加上了 <prop key="insert*">PROPAGATION_REQUIRED,-Exception</prop><prop key="save*">PROPAGATION_REQUIRED,-Exception</prop> 增加异常 但是还是不行 [b]问题补充:[/b] 现在将mysql 换成了6.0 还是不行 单数据库事务也不起作用 期待高手 [b]问题补充:[/b] 请问下3楼 会不会是table的engine是MyISAM类型的啊? 是什么意思 [b]问题补充:[/b] 三楼的 你好 我的数据类型是MyISAM类型 vhost | MyISAM | 10 | Dynamic | 9 | 348 | 3132 | 281474976710655 | 2048 | 0 | NULL | 20 8-06-17 10:48:04 | 2008-06-17 11:16:38 | NULL | utf8_general_ci | NUL | | |MyISAM
JTA使用Propagation.NESTED事务传播方式报错
# JTA使用Propagation.NESTED事务传播方式报错 spring boot配置JTA后,使用Propagation.NESTED事务传播方式,出现异常,切换其他传播方式代码正常。 <br/> 事务配置: A service: @Transactional @Override public void saveOrUpdate(Msg msg) { msgJDBCDAO.save(msg); MsgReceiver msgReceiver = new MsgReceiver(); msgReceiver.setId(msg.getMsgId()); msgReceiver.setMsgId(msg.getMsgId()); msgReceiver.setUserId(1000L); msgReceiver.setReadFlag(0); msgReceiver.setDeleteFlag(0); msgReceiverJDBCService.save(msgReceiver); } B service: @Transactional(propagation = Propagation.NESTED) @Override public void save(MsgReceiver msgReceiver) { msgReceiverJDBCDAO.save(msgReceiver); } <br/> <br/><br/><br/> ## 报错信息如下: org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [insert into t_msg_receiver values (?, ?, ?, ?, ?)]; SQL state [null]; error code [0]; Failed to suspend branch: XAResourceTransaction: 3139322E3136382E3232372E322E746D313537343036303233343835373030303031:3139322E3136382E3232372E322E746D31; nested exception is com.atomikos.jdbc.AtomikosSQLException: Failed to suspend branch: XAResourceTransaction: 3139322E3136382E3232372E322E746D313537343036303233343835373030303031:3139322E3136382E3232372E322E746D31 at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:89) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1442) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:632) at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:861) at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:916) at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:926) at com.spring.boot.example.dao.jdbc.MsgReceiverJDBCDAO.save(MsgReceiverJDBCDAO.java:16) at com.spring.boot.example.dao.jdbc.MsgReceiverJDBCDAO$$FastClassBySpringCGLIB$$bdb85c72.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) at com.spring.boot.example.dao.jdbc.MsgReceiverJDBCDAO$$EnhancerBySpringCGLIB$$6e56ffb6.save(<generated>) at com.spring.boot.example.service.jdbc.impl.MsgReceiverJDBCServiceImpl.save(MsgReceiverJDBCServiceImpl.java:21) at com.spring.boot.example.service.jdbc.impl.MsgReceiverJDBCServiceImpl$$FastClassBySpringCGLIB$$a40f40ea.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) at com.spring.boot.example.service.jdbc.impl.MsgReceiverJDBCServiceImpl$$EnhancerBySpringCGLIB$$65349f92.save(<generated>) at com.spring.boot.example.service.jdbc.impl.MsgJDBCServiceImpl.saveOrUpdate(MsgJDBCServiceImpl.java:46) at com.spring.boot.example.service.jdbc.impl.MsgJDBCServiceImpl$$FastClassBySpringCGLIB$$a07b1dd9.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) at com.spring.boot.example.service.jdbc.impl.MsgJDBCServiceImpl$$EnhancerBySpringCGLIB$$ecf643bf.saveOrUpdate(<generated>) at com.spring.boot.example.service.MsgJDBCServiceTest.test(MsgJDBCServiceTest.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74) at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) Caused by: com.atomikos.jdbc.AtomikosSQLException: Failed to suspend branch: XAResourceTransaction: 3139322E3136382E3232372E322E746D313537343036303233343835373030303031:3139322E3136382E3232372E322E746D31 at com.atomikos.jdbc.AtomikosSQLException.throwAtomikosSQLException(AtomikosSQLException.java:29) at com.atomikos.jdbc.AtomikosConnectionProxy.enlist(AtomikosConnectionProxy.java:217) at com.atomikos.jdbc.AtomikosConnectionProxy.invoke(AtomikosConnectionProxy.java:122) at com.sun.proxy.$Proxy98.prepareStatement(Unknown Source) at org.springframework.jdbc.core.JdbcTemplate$SimplePreparedStatementCreator.createPreparedStatement(JdbcTemplate.java:1555) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:614) ... 63 more Caused by: com.atomikos.datasource.xa.session.InvalidSessionHandleStateException: Failed to suspend branch: XAResourceTransaction: 3139322E3136382E3232372E322E746D313537343036303233343835373030303031:3139322E3136382E3232372E322E746D31 at com.atomikos.datasource.xa.session.BranchEnlistedStateHandler.transactionSuspended(BranchEnlistedStateHandler.java:98) at com.atomikos.datasource.xa.session.TransactionContext.transactionSuspended(TransactionContext.java:94) at com.atomikos.datasource.xa.session.SessionHandleState.notifyBeforeUse(SessionHandleState.java:165) at com.atomikos.jdbc.AtomikosConnectionProxy.enlist(AtomikosConnectionProxy.java:207) ... 67 more Caused by: com.mysql.cj.jdbc.MysqlXAException: XAER_INVAL: Invalid arguments (or unsupported command) at com.mysql.cj.jdbc.MysqlXAConnection.mapXAExceptionFromSQLException(MysqlXAConnection.java:344) at com.mysql.cj.jdbc.MysqlXAConnection.dispatchCommand(MysqlXAConnection.java:329) at com.mysql.cj.jdbc.MysqlXAConnection.end(MysqlXAConnection.java:267) at com.atomikos.datasource.xa.XAResourceTransaction.xaSuspend(XAResourceTransaction.java:700) at com.atomikos.datasource.xa.session.BranchEnlistedStateHandler.transactionSuspended(BranchEnlistedStateHandler.java:94) ... 70 more Caused by: java.sql.SQLException: XAER_INVAL: Invalid arguments (or unsupported command) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:764) at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:648) at
Spring事务的问题,bulkUpdate,或query.executeUpdate
今天在测试spring任务调度时,突然发现我配的声明事务不起作用了,找了好久才发现不是我的事务的问题,是我在Dao中用了一个方法有问题 方法如下: public void updateByIds(final Set<String> updateIds)throws DaoException{ try { String queryString="update from Yaoyueyingyue y set y.state='2' where y.yaoyueid in (?)"; getHibernateTemplate().bulkUpdate(queryString, updateIds.toArray()); } catch (Exception e) { e.printStackTrace(); throw new DaoException(this.getClassName()+e.getMessage()); } updateIds是一个包含要更新的编号集合,我发现用这个方法在我Manager中调用Dao事务就不起作用了,后来又改成这样 public void updateByIds(final Set<String> updateIds)throws DaoException{ try { getHibernateTemplate().execute(new HibernateCallback(){ final String hql="update Yaoyueyingyue y set y.state=2 where yaoyueid in (:yaoyueid)"; public Object doInHibernate(Session session) throws HibernateException, SQLException { Query query=session.createQuery(hql); query.setParameterList("yaoyueid", updateIds); query.executeUpdate(); return null; } }); } catch (Exception e) { e.printStackTrace(); throw new DaoException(this.getClassName()+e.getMessage()); } } 事务还是不行,这两个方法好像不受spring AOP事务管理,只要执行到这个Dao的方法就自动提交了,出来异常也不能回滚,真是郁闷,小弟对这块不是很明白,为什么事务就不行了呢,希望那位牛人,帮我解释下,谢谢了, 我的spring声明事务大概如下: <bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager" init-method="init" destroy-method="close"> <property name="forceShutdown"> <value>true</value></property> </bean> <bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp"> <property name="transactionTimeout" value="300"/> </bean> <bean id="springTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="transactionManager"><ref bean="atomikosTransactionManager" /></property> <property name="userTransaction"><ref bean="atomikosUserTransaction" /></property> </bean> <aop:config> <!-- This definition creates auto-proxy infrastructure based on the given pointcut, expressed in AspectJ pointcut language. Here: applying the advice named "txAdvice" to all methods on classes named PetStoreImpl. --> <aop:advisor pointcut="execution(* com.goal.log.manager.*.*(..))" advice-ref="txAdvice" /> <aop:advisor pointcut="execution(* com.goal.system.manager.*.*(..))" advice-ref="txAdvice" /> </aop:config> <!-- @Transactional 时要使用下面一行 --> <!-- <tx:annotation-driven transaction-manager="springTransactionManager" proxy-target-class="true"/> --> <!-- Transaction advice definition, based on method name patterns. Defaults to PROPAGATION_REQUIRED for all methods whose name starts with "insert" or "update", and to PROPAGATION_REQUIRED with read-only hint for all other methods.--> <!-- 引用springTransactionManager --> <tx:advice id="txAdvice" transaction-manager="springTransactionManager"> <tx:attributes> <tx:method name="save*" rollback-for="java.lang.Exception"/> <tx:method name="insert*" rollback-for="java.lang.Exception"/> .... <tx:method name="*" read-only="true" rollback-for="java.lang.Exception"/> </tx:attributes> </tx:advice> atomikosTransactionManager这个东西不用管,是一个开源的支持JTA分布式的JAR,希望有人能够为我解答........ [b]问题补充:[/b] 谢谢你的解答,但是我还是不明白你的意思,你是指我的Dao中用了内部类吗,你所指的 “调用updateByIds方法 的代码 跳出你的当前类 然后在别的类调用当前了类的接口中的方法updateByIds ”是指什么意思,能不能说明白点,谢谢了!!! [b]问题补充:[/b] 谢谢你的答复,你的意思我也理解,但好像不是这个问题,因为我并没有像你说的那样在类的内部调用,我的所有方法都是在业务逻辑层调用的Manager层,Manager层我是在Spring中配置了的声明事务的,我给你据个例子: 这两个方法都是Dao中的 方法一: [code="java"] public void updateByIds(final Set<String> updateIds)throws DaoException{ try { /*String queryString="update from Yaoyuepub y set y.state='2' where y.yaoyueid in (?)"; getHibernateTemplate().bulkUpdate(queryString, updateIds.toArray());*/ getHibernateTemplate().execute(new HibernateCallback(){ final String hql="update Yaoyuepub y set y.state=2 where yaoyueid in (:yaoyueid)"; public Object doInHibernate(Session session) throws HibernateException, SQLException { Query query=session.createQuery(hql); query.setParameterList("yaoyueid", updateIds); query.executeUpdate(); return null; } } ); } catch (Exception e) { e.printStackTrace(); throw new DaoException(this.getClassName()+e.getMessage()); } } [/code] 这个方法是把所有的要改的ID都一次性更新调,我是不想执行多条sql,在Manager中调用这个方法事务就起不了作用,还有一个方法,就是普通的更新对象 [code="java"] public void update(T t) throws DaoException { try { getHibernateTemplate().update(t); } catch (Exception e) { throw new DaoException(getClassName() + " update exception...",e); } } [/code] 要是把刚才Manager中调用改成循环执行下面的方法一个一个对象,就是有事务的,所以调用都一样,更类的内部调用应给没有关系的,我认为不管是query.executeUpdate还是spring自己提供的bulkUpdate这两个方法都是要写sql的,目的是满足批量更新和更大的灵活性,但是事务就不行了,我认为肯定可以让声明式事务支持这两个方法,就是不知道怎么配置一下,你可以自己在代码中分别做个例子试试,看看是不是用批量更新事务就控制不了了, 这就是我的理解,还请多多指教,谢谢诶!!! [b]问题补充:[/b] 我测试过了,以为可以了,但是还是不行,下面是我调用的一小部分代码 [code="java"] public void runThread() { Set<String> updateIds = new HashSet<String>(); for (Yaoyueyingyue yaoyueyingyue : yaoyueyingyues) { updateIds.add(yaoyueyingyue.getYaoyueid()); } if (updateIds.size() > 0) { yaoyuepubDao.updateByIds(updateIds); if(true) throw new RuntimeException("AAAAAAAAAAAAAAAAAAAAAAAAA"); yaoyueyingyueDao.updateByIds(updateIds); } [/code] 上面是我Manager中Spring任务调度自动执行的方法的一小部分,我中间估计抛出了异常,但是yaoyuepubDao数据库中都更新了,事务不起作用,我估计其实就是和bulkUpdate方法一样,只要这个方法能用事务控制了的话,应该没问题了 [b]问题补充:[/b] 下面是我在网上拷贝的--------------------------------   Spring的HibernateTemplate提供了Hibernate的完美封装,即通过匿名类实现回调,来保证Session的自动资源管理和事务的管理。其中核心方法是:   java代码: HibernateTemplate.execute(new HibernateCallback() {  public Object doInHibernate(Session session) throws HibernateException {   ....  } }   回调方法提供了session作为参数,有了session,就可以自由的使用Hibernate API编程了。使用了spring的之后,代码修改如下:   web层代码:   java代码: DetachedCriteria detachedCriteria = DetachedCriteria.forClass(Department.class); detachedCriteria.createAlias("employees", "e").add(Restrictions.eq("name", "department")).add(Restrictions.gt(("e.age"), new Integer(20))); departmentManager.findByCriteria(detachedCriteria);   构造detachedCriteria,作为参数传递给departmentManager   业务层代码使用spring,DepartmentManager的findByCriteria如下:   java代码: public List findByCriteria(final DetachedCriteria detachedCriteria) {  return (List) getHibernateTemplate().execute(new HibernateCallback() {   public Object doInHibernate(Session session) throws HibernateException {    Criteria criteria = detachedCriteria.getExecutableCriteria(session);    return criteria.list();   }  }); }   实际上也就是:   java代码: Criteria criteria = detachedCriteria.getExecutableCriteria(session); return criteria.list();   而已   但是该程序代码执行,会抛出强制类型转换异常!   我跟踪了一下spring和Hibernate源代码,原因如下:   spring的HibernateTemplate的execute方法提供的回调接口具有Session作为参数,但是实际上,默认情况下,HibernateTemplate传递给回调接口的session并不是org.hibernate.impl.SessionImpl类,而是SessionImpl类的一个Proxy类。之所以替换成为一个Proxy类,HibernateTemplate的注释说明,Proxy提供了一些额外的功能,包括自动设置Cachable,Transaction的超时时间,Session资源的更积极的关闭等等。   java代码: private boolean exposeNativeSession = false; ...   execute方法内部: Session sessionToExpose = (exposeNativeSession ? session : createSessionProxy(session));   但是遗憾的是,Hibernate的DetachedCriteria的setExecutableCriteria方法却要求将session参数强制转为SessionImpl,但是spring传过来的却是一个Proxy类,因此就报错了。   java代码: public Criteria getExecutableCriteria(Session session) {  impl.setSession( (SessionImpl) session ); // 要求SessionImpl,Spring传递的是Proxy  return impl; }   解决方法,禁止Spring的HibernateTemplate传递Proxy类,强制要求它传递真实的SessionImpl类,即给exexute方法增加一个参数,提供参数为true,如下:   java代码: public List findByCriteria(final DetachedCriteria detachedCriteria) {  return (List) getHibernateTemplate().execute(new HibernateCallback() {   public Object doInHibernate(Session session) throws HibernateException {    Criteria criteria = detachedCriteria.getExecutableCriteria(session);    return criteria.list();   }  }, true); } [b]问题补充:[/b] bulkUpdate这个方法按你给的源码,那我是用错了,但是你所说的我的模拟异常不再AOP的事务之内,我就不同意你的观点了,[code="java"] if (updateIds.size() > 0) { yaoyuepubDao.updateByIds(updateIds); // 事务开启 执行updateByIds 事务提交 if(true) throw new RuntimeException("AAAAAAAAAAAAAAAAAAAAAAAAA"); yaoyueyingyueDao.updateByIds(updateIds); // 事务开启 执行updateByIds 事务提交 } [/code] 我这段代码是两个Dao的操作,而这两个Dao的操作是被封装在一个Manger中的方法中的,Manager的每个方法都是有事务的,在操作玩第一个Dao后抛出一个RunTime异常,这时候第一个Dao操作已经执行了,这时候事务应该回滚的,不应该去更新的第一个Dao的操作,Manager中本来就业务层,中间有好多的Dao操作,事务应该控制这些Dao要不都提交,要不都回滚,你说呢,而你说的在11-12行之间加异常,那在一个Dao中,再说的的Dao是没有配事务的,又何谈回滚呢,要是把我上面两个Dao操作改成普通的对象更新,是可以回滚的,这个我肯定 比如这样 [code="java"] yaoyuepubDao.update(yaoyuepub); if(true) throw new RuntimeException("AAAAAAAAAAAAAAAAAAAAAAAAA"); yaoyueyingyueDao.update(yaoyueyingyue); [/code] 这个时候如果抛出异常,yaoyuepub是不会更新到数据库的,会回滚的,所以我总结就是executeUpdate(sql)这个方法我们直接sql,和操作对象是不一样的的,具体我也没有研究 [b]问题补充:[/b] [code="java"] public void updateByIds(final Set<String> updateIds)throws DaoException{ try { getHibernateTemplate().execute(new HibernateCallback(){ final String hql="update Yaoyuepub y set y.state=2 where yaoyueid in (:yaoyueid)"; public Object doInHibernate(Session session) throws HibernateException, SQLException { Query query=session.createQuery(hql); query.setParameterList("yaoyueid", updateIds); query.executeUpdate(); return null; } } , true); } catch (Exception e) { e.printStackTrace(); throw new DaoException(this.getClassName()+e.getMessage()); } } [/code] 把上面的updateIds方法改成: [code="java"] public void updateByIds(final Set<String> updateIds)throws DaoException{ try { DetachedCriteria dc=DetachedCriteria.forClass(Yaoyuepub.class); dc.add(Restrictions.in("yaoyueid", updateIds)); List<Yaoyuepub> yaoyuepubs=select(dc); for(Yaoyuepub y:yaoyuepubs){ update(y); } } catch (Exception e) { e.printStackTrace(); throw new DaoException(this.getClassName()+e.getMessage()); } } [/code] 所有的调用都不变,spring事务就起作用了,说明自己createQuery然后executeUpdate是不被事务管理的,后其他都没有关系
动态规划入门到熟悉,看不懂来打我啊
持续更新。。。。。。 2.1斐波那契系列问题 2.2矩阵系列问题 2.3跳跃系列问题 3.1 01背包 3.2 完全背包 3.3多重背包 3.4 一些变形选讲 2.1斐波那契系列问题 在数学上,斐波纳契数列以如下被以递归的方法定义:F(0)=0,F(1)=1, F(n)=F(n-1)+F(n-2)(n&gt;=2,n∈N*)根据定义,前十项为1, 1, 2, 3...
程序员,职场上请远离这种人!
对有些职场人来讲,甩锅就是一种生存手段。01.从大学打篮球说起上大学的时候喜欢打篮球,然后我又特别喜欢抢篮板,经常是跳起来的时候没事,落下来的时候偶尔会踩到别人的脚上,于...
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私...
对计算机专业来说学历真的重要吗?
我本科学校是渣渣二本,研究生学校是985,现在毕业五年,校招笔试、面试,社招面试参加了两年了,就我个人的经历来说下这个问题。 这篇文章很长,但绝对是精华,相信我,读完以后,你会知道学历不好的解决方案,记得帮我点赞哦。 先说结论,无论赞不赞同,它本质就是这样:对于技术类工作而言,学历五年以内非常重要,但有办法弥补。五年以后,不重要。 目录: 张雪峰讲述的事实 我看到的事实 为什么会这样 ...
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
Python——画一棵漂亮的樱花树(不同种樱花+玫瑰+圣诞树喔)
最近翻到一篇知乎,上面有不少用Python(大多是turtle库)绘制的树图,感觉很漂亮,我整理了一下,挑了一些我觉得不错的代码分享给大家(这些我都测试过,确实可以生成) one 樱花树 动态生成樱花 效果图(这个是动态的): 实现代码 import turtle as T import random import time # 画樱花的躯干(60,t) def Tree(branch, ...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
一个读研让我损失了一百万的真实故事
关注我!只要10分钟,包你学会数据分析 毕业后,应该就业还是考研? 我刚出国留学那会儿,就惊讶的发现,外国local95%都不会选择读研 他们说,硕士学费很贵,时间宝贵,老板不认,所以很费 当几乎所有人都是本科学历时,硕士学历反而像个异类 在老板眼里,三年硕士远远不如3年的工作经验实用 他们甚至专门为拒绝高学历者发明了一个词,叫overoccupie...
Python 植物大战僵尸代码实现(2):植物卡片选择和种植
这篇文章要介绍的是: - 上方植物卡片栏的实现。 - 点击植物卡片,鼠标切换为植物图片。 - 鼠标移动时,判断当前在哪个方格中,并显示半透明的植物作为提示。
西游记团队中如果需要裁掉一个人,会先裁掉谁?
2019年互联网寒冬,大批企业开始裁员,下图是网上流传的一张截图: 裁员不可避免,那如何才能做到不管大环境如何变化,自身不受影响呢? 我们先来看一个有意思的故事,如果西游记取经团队需要裁员一名,会裁掉谁呢,为什么? 西游记团队组成: 1.唐僧 作为团队teamleader,有很坚韧的品性和极高的原则性,不达目的不罢休,遇到任何问题,都没有退缩过,又很得上司支持和赏识(直接得到唐太宗的任命,既给袈...
shell脚本:备份数据库、代码上线
备份MySQL数据库 场景: 一台MySQL服务器,跑着5个数据库,在没有做主从的情况下,需要对这5个库进行备份 需求: 1)每天备份一次,需要备份所有的库 2)把备份数据存放到/data/backup/下 3)备份文件名称格式示例:dbname-2019-11-23.sql 4)需要对1天以前的所有sql文件压缩,格式为gzip 5)本地数据保留1周 6)需要把备份的数据同步到远程备份中心,假如...
聊聊C语言和指针的本质
坐着绿皮车上海到杭州,24块钱,很宽敞,在火车上非正式地聊几句。 很多编程语言都以 “没有指针” 作为自己的优势来宣传,然而,对于C语言,指针却是与生俱来的。 那么,什么是指针,为什么大家都想避开指针。 很简单, 指针就是地址,当一个地址作为一个变量存在时,它就被叫做指针,该变量的类型,自然就是指针类型。 指针的作用就是,给出一个指针,取出该指针指向地址处的值。为了理解本质,我们从计算机模型说起...
为什么你学不过动态规划?告别动态规划,谈谈我的经验
动态规划难吗?说实话,我觉得很难,特别是对于初学者来说,我当时入门动态规划的时候,是看 0-1 背包问题,当时真的是一脸懵逼。后来,我遇到动态规划的题,看的懂答案,但就是自己不会做,不知道怎么下手。就像做递归的题,看的懂答案,但下不了手,关于递归的,我之前也写过一篇套路的文章,如果对递归不大懂的,强烈建议看一看:为什么你学不会递归,告别递归,谈谈我的经验 对于动态规划,春招秋招时好多题都会用到动态...
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外...
字节跳动面试官这样问消息队列:分布式事务、重复消费、顺序消费,我整理了一下
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式和人才交流群,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸...
如何安装 IntelliJ IDEA 最新版本——详细教程
IntelliJ IDEA 简称 IDEA,被业界公认为最好的 Java 集成开发工具,尤其在智能代码助手、代码自动提示、代码重构、代码版本管理(Git、SVN、Maven)、单元测试、代码分析等方面有着亮眼的发挥。IDEA 产于捷克,开发人员以严谨著称的东欧程序员为主。IDEA 分为社区版和付费版两个版本。 我呢,一直是 Eclipse 的忠实粉丝,差不多十年的老用户了。很早就接触到了 IDEA...
面试还搞不懂redis,快看看这40道面试题(含答案和思维导图)
Redis 面试题 1、什么是 Redis?. 2、Redis 的数据类型? 3、使用 Redis 有哪些好处? 4、Redis 相比 Memcached 有哪些优势? 5、Memcache 与 Redis 的区别都有哪些? 6、Redis 是单进程单线程的? 7、一个字符串类型的值能存储最大容量是多少? 8、Redis 的持久化机制是什么?各自的优缺点? 9、Redis 常见性...
大学四年自学走来,这些珍藏的「实用工具/学习网站」我全贡献出来了
知乎高赞:文中列举了互联网一线大厂程序员都在用的工具集合,涉及面非常广,小白和老手都可以进来看看,或许有新收获。
为什么要推荐大家学习字节码?
配套视频: 为什么推荐大家学习Java字节码 https://www.bilibili.com/video/av77600176/ 一、背景 本文主要探讨:为什么要学习 JVM 字节码? 可能很多人会觉得没必要,因为平时开发用不到,而且不学这个也没耽误学习。 但是这里分享一点感悟,即人总是根据自己已经掌握的知识和技能来解决问题的。 这里有个悖论,有时候你觉得有些技术没用恰恰是...
【超详细分析】关于三次握手与四次挥手面试官想考我们什么?
在面试中,三次握手和四次挥手可以说是问的最频繁的一个知识点了,我相信大家也都看过很多关于三次握手与四次挥手的文章,今天的这篇文章,重点是围绕着面试,我们应该掌握哪些比较重要的点,哪些是比较被面试官给问到的,我觉得如果你能把我下面列举的一些点都记住、理解,我想就差不多了。 三次握手 当面试官问你为什么需要有三次握手、三次握手的作用、讲讲三次三次握手的时候,我想很多人会这样回答: 首先很多人会先讲下握...
压测学习总结(1)——高并发性能指标:QPS、TPS、RT、吞吐量详解
一、QPS,每秒查询 QPS:Queries Per Second意思是“每秒查询率”,是一台服务器每秒能够相应的查询次数,是对一个特定的查询服务器在规定时间内所处理流量多少的衡量标准。互联网中,作为域名系统服务器的机器的性能经常用每秒查询率来衡量。 二、TPS,每秒事务 TPS:是TransactionsPerSecond的缩写,也就是事务数/秒。它是软件测试结果的测量单位。一个事务是指一...
新程序员七宗罪
当我发表这篇文章《为什么每个工程师都应该开始考虑开发中的分析和编程技能呢?》时,我从未想到它会对读者产生如此积极的影响。那些想要开始探索编程和数据科学领域的人向我寻求建议;还有一些人问我下一篇文章的发布日期;还有许多人询问如何顺利过渡到这个职业。我非常鼓励大家继续分享我在这个旅程的经验,学习,成功和失败,以帮助尽可能多的人过渡到一个充满无数好处和机会的职业生涯。亲爱的读者,谢谢你。 -罗伯特。 ...
2019年Spring Boot面试都问了什么?快看看这22道面试题!
Spring Boot 面试题 1、什么是 Spring Boot? 2、Spring Boot 有哪些优点? 3、什么是 JavaConfig? 4、如何重新加载 Spring Boot 上的更改,而无需重新启动服务器? 5、Spring Boot 中的监视器是什么? 6、如何在 Spring Boot 中禁用 Actuator 端点安全性? 7、如何在自定义端口上运行 Sprin...
【图解】记一次手撕算法面试:字节跳动的面试官把我四连击了
字节跳动这家公司,应该是所有秋招的公司中,对算法最重视的一个了,每次面试基本都会让你手撕算法,今天这篇文章就记录下当时被问到的几个算法题,并且每个算法题我都详细着给出了最优解,下面再现当时的面试场景。看完一定让你有所收获 一、小牛试刀:有效括号 大部分情况下,面试官都会问一个不怎么难的问题,不过你千万别太开心,因为这道题往往可以拓展出更多有难度的问题,或者一道题看起来很简单,但是给出最优解,确实很...
面试官:关于Java性能优化,你有什么技巧
通过使用一些辅助性工具来找到程序中的瓶颈,然后就可以对瓶颈部分的代码进行优化。 一般有两种方案:即优化代码或更改设计方法。我们一般会选择后者,因为不去调用以下代码要比调用一些优化的代码更能提高程序的性能。而一个设计良好的程序能够精简代码,从而提高性能。 下面将提供一些在JAVA程序的设计和编码中,为了能够提高JAVA程序的性能,而经常采用的一些方法和技巧。 1.对象的生成和大小的调整。 J...
【图解算法面试】记一次面试:说说游戏中的敏感词过滤是如何实现的?
版权声明:本文为苦逼的码农原创。未经同意禁止任何形式转载,特别是那些复制粘贴到别的平台的,否则,必定追究。欢迎大家多多转发,谢谢。 小秋今天去面试了,面试官问了一个与敏感词过滤算法相关的问题,然而小秋对敏感词过滤算法一点也没听说过。于是,有了下下事情的发生… 面试官开怼 面试官:玩过王者荣耀吧?了解过敏感词过滤吗?,例如在游戏里,如果我们发送“你在干嘛?麻痹演员啊你?”,由于“麻痹”是一个敏感词,...
GitHub 标星 1.6w+,我发现了一个宝藏项目,作为编程新手有福了!
大家好,我是 Rocky0429,一个最近老在 GitHub 上闲逛的蒟蒻… 特别惭愧的是,虽然我很早就知道 GitHub,但是学会逛 GitHub 的时间特别晚。当时一方面是因为菜,看着这种全是英文的东西难受,不知道该怎么去玩,另一方面是一直在搞 ACM,没有做一些工程类的项目,所以想当然的以为和 GitHub 也没什么关系(当然这种想法是错误的)。 后来自己花了一个星期看完了 Pyt...
杭漂程序员2019的心路历程,还不起助学贷款,交不起房租,披荆斩棘终雨过天晴
一个杭漂2019的心酸历程,一路披荆斩棘终于还是雨过天晴。
我采访了同事,让他掏出了每天都会浏览的干货网站
前言只有光头才能变强。文本已收录至我的GitHub精选文章,欢迎Star:https://github.com/ZhongFuCheng3y/3y在周六的晚上,我日常去到公司写文章。想写...
Java知识体系最强总结(2020版)
更新于2019-12-15 10:38:00 本人从事Java开发已多年,平时有记录问题解决方案和总结知识点的习惯,整理了一些有关Java的知识体系,这不是最终版,会不定期的更新。也算是记录自己在从事编程工作的成长足迹,通过博客可以促进博主与阅读者的共同进步,结交更多志同道合的朋友。特此分享给大家,本人见识有限,写的博客难免有错误或者疏忽的地方,还望各位大佬指点,在此表示感激不尽。 文章目录...
计算机专业的书普遍都这么贵,你们都是怎么获取资源的?
介绍几个可以下载编程电子书籍的网站。 1.Github Github上编程书资源很多,你可以根据类型和语言去搜索。推荐几个热门的: free-programming-books-zh_CN:58K 星的GitHub,编程语言、WEB、函数、大数据、操作系统、在线课程、数据库相关书籍应有尽有,共有几百本。 Go语言高级编程:涵盖CGO,Go汇编语言,RPC实现,Protobuf插件实现,Web框架实...
2020年一线城市程序员工资大调查
人才需求 一线城市共发布岗位38115个,招聘120827人。 其中 beijing 22805 guangzhou 25081 shanghai 39614 shenzhen 33327 工资分布 2020年中国一线城市程序员的平均工资为16285元,工资中位数为14583元,其中95%的人的工资位于5000到20000元之间。 和往年数据比较: yea...
毕业5年,我问遍了身边的大佬,总结了他们的学习方法
我问了身边10个大佬,总结了他们的学习方法,原来成功都是有迹可循的。
这些软件太强了,Windows必装!尤其程序员!
Windows可谓是大多数人的生产力工具,集娱乐办公于一体,虽然在程序员这个群体中都说苹果是信仰,但是大部分不都是从Windows过来的,而且现在依然有很多的程序员用Windows。 所以,今天我就把我私藏的Windows必装的软件分享给大家,如果有一个你没有用过甚至没有听过,那你就赚了????,这可都是提升你幸福感的高效率生产力工具哦! 走起!???? NO、1 ScreenToGif 屏幕,摄像头和白板...
大学四年因为知道了这32个网站,我成了别人眼中的大神!
依稀记得,毕业那天,我们导员发给我毕业证的时候对我说“你可是咱们系的风云人物啊”,哎呀,别提当时多开心啦????,嗯,我们导员是所有导员中最帅的一个,真的???? 不过,导员说的是实话,很多人都叫我大神的,为啥,因为我知道这32个网站啊,你说强不强????,这次是绝对的干货,看好啦,走起来! PS:每个网站都是学计算机混互联网必须知道的,真的牛杯,我就不过多介绍了,大家自行探索,觉得没用的,尽管留言吐槽吧???? 社...
史上最全的IDEA快捷键总结
现在Idea成了主流开发工具,这篇博客对其使用的快捷键做了总结,希望对大家的开发工作有所帮助。
2020年,冯唐49岁:我给20、30岁IT职场年轻人的建议
点击“技术领导力”关注∆每天早上8:30推送 作者|Mr.K 编辑| Emma 来源|技术领导力(ID:jishulingdaoli) 前天的推文《冯唐:职场人35岁以后,方法论比经验重要》,收到了不少读者的反馈,觉得挺受启发。其实,冯唐写了不少关于职场方面的文章,都挺不错的。可惜大家只记住了“春风十里不如你”、“如何避免成为油腻腻的中年人”等不那么正经的文章。 本文整理了冯...
春节不出门!这三款超好评编程游戏,好玩到停不下来
By 超神经场景描述:春节马上就要来临,在这个假期里,怎么能让自己放松,又不至于生疏了自己的老本行?不妨来玩一下编程向的小游戏吧,超神经在此整理了三款好玩有趣又有深度的游戏,快看看是不是...
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东...
Python实战:抓肺炎疫情实时数据,画2019-nCoV疫情地图
今天,群里白垩老师问如何用python画武汉肺炎疫情地图。白垩老师是研究海洋生态与地球生物的学者,国家重点实验室成员,于不惑之年学习python,实为我等学习楷模。先前我并没有关注武汉肺炎的具体数据,也没有画过类似的数据分布图。于是就拿了两个小时,专门研究了一下,遂成此文。
相关热词 c# 数组类型 泛型约束 c#的赛狗日程序 c# 传递数组 可变参数 c# 生成存储过程 c# list 补集 c#获得所有窗体 c# 当前秒数转成年月日 c#中的枚举 c# 计算校验和 连续随机数不重复c#
立即提问