Code Monkey home page Code Monkey logo

Comments (4)

emacarron avatar emacarron commented on June 9, 2024

Can you please add the thread name (or id) to the log?

from spring.

snowwolf007cn avatar snowwolf007cn commented on June 9, 2024

Thanks for replied, I add some log in my Service Implementation, and here is the log:

2013-05-16 10:02:41 973 DEBUG: com.ssports.db.TransTest - Invoking service method[addRecords]
2013-05-16 10:02:41 973 DEBUG: com.ssports.db.TransTest - Thread Name: main
2013-05-16 10:02:41 973 DEBUG: com.ssports.db.TransTest - Thread id: 1
2013-05-16 10:02:41 976 DEBUG: org.springframework.jdbc.datasource.DataSourceTransactionManager - Creating new transaction with name [com.ssports.test.service.TestServiceImpl.addRecords]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
2013-05-16 10:02:41 977 DEBUG: org.springframework.jdbc.datasource.DataSourceTransactionManager - Acquired Connection [org.apache.commons.dbcp.PoolableConnection@5ea4007a] for JDBC transaction
2013-05-16 10:02:41 979 DEBUG: org.springframework.jdbc.datasource.DataSourceTransactionManager - Switching JDBC Connection [org.apache.commons.dbcp.PoolableConnection@5ea4007a] to manual commit
2013-05-16 10:02:41 980 DEBUG: com.ssports.test.service.TestServiceImpl - Thread Name: main
2013-05-16 10:02:41 980 DEBUG: com.ssports.test.service.TestServiceImpl - Thread id: 1
2013-05-16 10:02:41 980 INFO : com.ssports.test.service.TestServiceImpl - 4:1368669761
2013-05-16 10:02:41 981 DEBUG: org.mybatis.spring.SqlSessionUtils - Creating a new SqlSession
2013-05-16 10:02:41 981 DEBUG: org.mybatis.spring.SqlSessionUtils - Registering transaction synchronization for SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@7ffb0a21]
2013-05-16 10:02:41 984 DEBUG: org.mybatis.spring.transaction.SpringManagedTransaction - JDBC Connection [org.apache.commons.dbcp.PoolableConnection@bc691e0] will be managed by Spring
2013-05-16 10:02:41 984 DEBUG: com.ssports.test.mapper.RecordMapper.insert - ooo Using Connection [org.apache.commons.dbcp.PoolableConnection@bc691e0]
2013-05-16 10:02:41 985 DEBUG: com.ssports.test.mapper.RecordMapper.insert - ==> Preparing: insert into test (id, content, position, time) values (?, ?, ?, ?)
2013-05-16 10:02:41 985 DEBUG: com.ssports.test.mapper.RecordMapper.insert - ==> Parameters: null, ddd(String), 4(Integer), 1368669761(Integer)
2013-05-16 10:02:42 036 DEBUG: org.mybatis.spring.SqlSessionUtils - Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@7ffb0a21]
2013-05-16 10:02:42 036 DEBUG: com.ssports.test.service.TestServiceImpl - Thread Name: main
2013-05-16 10:02:42 036 DEBUG: com.ssports.test.service.TestServiceImpl - Thread id: 1
2013-05-16 10:02:42 036 INFO : com.ssports.test.service.TestServiceImpl - 0:1368164281
2013-05-16 10:02:42 036 DEBUG: org.mybatis.spring.SqlSessionUtils - Fetched SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@7ffb0a21] from current transaction
2013-05-16 10:02:42 036 DEBUG: com.ssports.test.mapper.RecordMapper.insert - ooo Using Connection [org.apache.commons.dbcp.PoolableConnection@bc691e0]
2013-05-16 10:02:42 037 DEBUG: com.ssports.test.mapper.RecordMapper.insert - ==> Preparing: insert into test (id, content, position, time) values (?, ?, ?, ?)
2013-05-16 10:02:42 037 DEBUG: com.ssports.test.mapper.RecordMapper.insert - ==> Parameters: null, test(String), 0(Integer), 1368164281(Integer)
2013-05-16 10:02:42 113 DEBUG: org.mybatis.spring.SqlSessionUtils - Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@7ffb0a21]
2013-05-16 10:02:42 114 DEBUG: org.springframework.jdbc.datasource.DataSourceTransactionManager - Initiating transaction rollback
2013-05-16 10:02:42 114 DEBUG: org.springframework.jdbc.datasource.DataSourceTransactionManager - Rolling back JDBC transaction on Connection [org.apache.commons.dbcp.PoolableConnection@5ea4007a]
2013-05-16 10:02:42 114 DEBUG: org.mybatis.spring.SqlSessionUtils - Transaction synchronization rolling back SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@7ffb0a21]
2013-05-16 10:02:42 114 DEBUG: org.mybatis.spring.SqlSessionUtils - Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@7ffb0a21]
2013-05-16 10:02:42 115 DEBUG: org.springframework.jdbc.datasource.DataSourceTransactionManager - Releasing JDBC Connection [org.apache.commons.dbcp.PoolableConnection@5ea4007a] after transaction
2013-05-16 10:02:42 115 DEBUG: com.ssports.db.TransTest - Exception throw

from spring.

snowwolf007cn avatar snowwolf007cn commented on June 9, 2024

I also raise a question on stackoverflow.com, and here is the link, which you can find more details on my sample project code. hope it'll give some help.

http://stackoverflow.com/questions/16559197/data-inserted-into-db-after-spring-transaction-rollback/16576600?noredirect=1#16576600

from spring.

snowwolf007cn avatar snowwolf007cn commented on June 9, 2024

It can be closed now, I found that there is something wrong with my service Implementation that I start the context twice. sorry for bother.

from spring.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.