16:37:19. [HTTP - nio - 8080-959 the exec - 9] the DEBUG org. Mybatis. Spring. SqlSessionUtils - SqlSession [org. Apache. Ibatis. Session. Defaults. DefaultSqlSession @ 3317 ea24] was not registered for synchronization because synchronization is not active
16:37:19. [HTTP - nio - 8080-971 the exec - 9] the DEBUG org. Mybatis. Spring. SqlSessionUtils - Closing non transactional SqlSession [org. Apache. Ibatis. Session. Defaults. DefaultSqlSession @ 3317 ea24]
After writing the code, the code without error, but shows the SQL transaction no, while performing the login is also appeared but when using a select statement in the code will handle affairs or run successfully, I'm calling the other a statement will appear when the insert statement above three sentences show the transaction are not synchronized, my two SQL statements is operating in different tables, there is no error code, very helpless, don't know where no,
INSERT INTO user_lost_pick VALUES (# # {item_id}, {item_name}, # {user_name}, # {contact}, # {item_time}, # {item_location}, # {item_type}, # {lostpost}, # {tel})
Call the above SQL statement omitted some dao class service class
IUserService. Insertwu (wu);
CodePudding user response:
Look at things in the spring configuration file control layer service path write wrong notCodePudding user response:
1 see SQL related configuration have wrong2 put the SQL statements in database operation to see have baa problem
3 look at the values have baa problem
Sometimes is a careless, is unlikely to be related or data to the result of what went wrong, is not necessarily the SQL language has a problem
CodePudding user response:
SQL statement to not have a problem, to get the value of the small program in SSM background are received and output a success, but the output seems to be more a item_id=0, but I don't have database item_id=0, the value of the other item_id, should not affect his insert,This is the way to the service
Public Map
Return iUserDao. Insertwu (wu);
}
This is the dao methods
@ Override
Public Map
Try {
Return this. UserDao. Insertwu (wu);
} the catch (Exception e) {
e.printStackTrace();
}
Return (Map
}
CodePudding user response:
CodePudding user response:
Insert (Wu) method to add a transaction try, error message you, the transaction has not been activatedCodePudding user response:
Stick your XML configuration of Mybatis out have a look at your service implementation method of the insertCodePudding user response:
Spring - mybastic XML file<? The XML version="1.0" encoding="utf-8"?>
XMLNS: context="http://www.springframework.org/schema/context"
XMLNS: tx="http://www.springframework.org/schema/tx"
Xsi: schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd "& gt;