emacarron / old-google-code-issues

Automatically exported from code.google.com/p/mybatis
0 stars 0 forks source link

spring3 mybatis3 transaction not rollback!!!!!! #743

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What version of the MyBatis are you using?
mbatis3.1.1

Please describe the problem.  Unit tests are best!
DEBUG 2012-12-22 02:10:31,604 
org.springframework.jdbc.datasource.DataSourceUtils: Fetching JDBC Connection 
from DataSource
DEBUG 2012-12-22 02:10:31,604 
org.springframework.jdbc.datasource.DriverManagerDataSource: Creating new JDBC 
DriverManager Connection to [jdbc:oracle:thin:@localhost:1521:accp11g]
DEBUG 2012-12-22 02:10:31,619 
org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl: JDBC Connection 
[oracle.jdbc.driver.T4CConnection@a68a10] will not be managed by Spring
DEBUG 2012-12-22 02:10:31,622 
org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl: ooo Using 
Connection [oracle.jdbc.driver.T4CConnection@a68a10]
DEBUG 2012-12-22 02:10:31,625 
org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl: ==>  Preparing: 
select idauto.nextval from dual 
DEBUG 2012-12-22 02:10:31,760 
org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl: ==> Parameters: 
DEBUG 2012-12-22 02:10:31,791 
org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl: <==    Columns: 
NEXTVAL
DEBUG 2012-12-22 02:10:31,801 
org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl: <==        Row: 136
DEBUG 2012-12-22 02:10:31,806 
org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl: ooo Using 
Connection [oracle.jdbc.driver.T4CConnection@a68a10]
DEBUG 2012-12-22 02:10:31,806 
org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl: ==>  Preparing: 
insert into userinfo(id,username,password,age,insertDate) values(?,?,?,?,?) 
DEBUG 2012-12-22 02:10:31,806 
org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl: ==> Parameters: 
136(Long), 高洪岩(String), 岩洪高(String), 100(Integer), 2012-12-22 
02:10:31.424(Timestamp)
DEBUG 2012-12-22 02:10:31,808 
org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl: Closing non 
transactional SqlSession 
[org.apache.ibatis.session.defaults.DefaultSqlSession@fa8363]
DEBUG 2012-12-22 02:10:31,809 
org.springframework.jdbc.datasource.DataSourceUtils: Returning JDBC Connection 
to DataSource
DEBUG 2012-12-22 02:10:31,810 
org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl: Creating a new 
SqlSession
DEBUG 2012-12-22 02:10:31,810 
org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl: SqlSession 
[org.apache.ibatis.session.defaults.DefaultSqlSession@1dea16c] was not 
registered for synchronization because synchronization is not active
DEBUG 2012-12-22 02:10:31,811 
org.springframework.jdbc.datasource.DataSourceUtils: Fetching JDBC Connection 
from DataSource
DEBUG 2012-12-22 02:10:31,812 
org.springframework.jdbc.datasource.DriverManagerDataSource: Creating new JDBC 
DriverManager Connection to [jdbc:oracle:thin:@localhost:1521:accp11g]
DEBUG 2012-12-22 02:10:31,826 
org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl: JDBC Connection 
[oracle.jdbc.driver.T4CConnection@753e7a] will not be managed by Spring
DEBUG 2012-12-22 02:10:31,826 
org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl: ooo Using 
Connection [oracle.jdbc.driver.T4CConnection@753e7a]
DEBUG 2012-12-22 02:10:31,826 
org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl: ==>  Preparing: 
select idauto.nextval from dual 
DEBUG 2012-12-22 02:10:31,826 
org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl: ==> Parameters: 
DEBUG 2012-12-22 02:10:31,827 
org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl: <==    Columns: 
NEXTVAL
DEBUG 2012-12-22 02:10:31,828 
org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl: <==        Row: 137
DEBUG 2012-12-22 02:10:31,828 
org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl: ooo Using 
Connection [oracle.jdbc.driver.T4CConnection@753e7a]
DEBUG 2012-12-22 02:10:31,828 
org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl: ==>  Preparing: 
insert into userinfo(id,username,password,age,insertDate) values(?,?,?,?,?) 
DEBUG 2012-12-22 02:10:31,828 
org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl: ==> Parameters: 
137(Long), 
大中国12大中国12大中国12大中国12大中国12大中国12大中国12大
中国12大中国12大中国12大中国12(String), 大中国(String), 
100(Integer), 2012-12-22 02:10:31.424(Timestamp)
DEBUG 2012-12-22 02:10:31,861 org.springframework.core.env.AbstractEnvironment: 
Initializing new StandardEnvironment
DEBUG 2012-12-22 02:10:31,861 
org.springframework.core.env.MutablePropertySources: Adding [systemProperties] 
PropertySource with lowest search precedence

What is the expected output? What do you see instead?

Can you provide stack trace, logs, error messages that are displayed?
uncategorized SQLException for SQL []; SQL state [72000]; error code [12899]; 
ORA-12899: 列 "GHY"."USERINFO"."USERNAME" 的值太大 (实际值: 88, 
最大值: 50)

Please provide any additional information below.
    @RequestMapping(value = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    @Transactional
    public void abc() {
        String username = "高洪岩";
        String password = "岩洪高";
        int age = 100;
        Date nowDate = new Date();

        this.getAllService().getUserinfoService().insertUserinfo(username,
                password, age, nowDate);

        username = "高洪岩12高洪岩12高洪岩12高洪岩12高洪岩12高洪岩12高洪岩12高洪岩12高洪岩12高洪岩12高洪岩12";
        this.getAllService().getUserinfoService().insertUserinfo(username,
                password, age, nowDate);
    }
---------------------------------------
springMVC-servlet.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:p="http://www.springframework.org/schema/p"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    <context:component-scan base-package="controller" />
</beans>

--------------------
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:p="http://www.springframework.org/schema/p"
    xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">

    <context:component-scan base-package="ssm.dao">
    </context:component-scan>
    <context:component-scan base-package="ssm.service">
    </context:component-scan>   

    <bean id="dataSource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver">
        </property>
        <property name="url" value="jdbc:oracle:thin:@localhost:1521:accp11g">
        </property>
        <property name="username" value="ghy">
        </property>
        <property name="password" value="123">
        </property>
    </bean>

    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="configLocation" value="classpath:mybatis-3-config.xml" />
        <property name="mapperLocations">
            <list>
                <value>classpath*:/ssm.orm/*.xml</value>
            </list>
        </property>
    </bean>

    <bean id="transactionManager"
        class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="dataSource" />
    </bean>
    <tx:annotation-driven transaction-manager="transactionManager" />

    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="basePackage" value="ssm.orm" />
    </bean>

</beans>
---------------------------
run result is db save 1 row record!!!

why ? please help me!

Original issue reported on code.google.com by ghygh...@gmail.com on 21 Dec 2012 at 6:39

GoogleCodeExporter commented 9 years ago
Please use the mail list for questions and doubts. The tracker is only to 
report defects or propose features.

Original comment by eduardo.macarron on 22 Dec 2012 at 8:59