spring mvc - Transaction rollback not work(I've already add @EnableTransactionManagement and @Transactional) -


@configuration @import({datasourceconfig.class}) @enabletransactionmanagement(proxytargetclass = true) @enableaspectjautoproxy(proxytargetclass = true) @componentscan(basepackages = "**.service") public class rootconfig {}   @bean @dependson(value = "datasource") public datasourcetransactionmanager transactionmanager() {     return new datasourcetransactionmanager(datasource()); } 

the config above,and service code below

@override @transactional public int rechargechannel(int channelid) {     chargerecord chargerecord = new chargerecord();     chargerecord.setchannelid(channelid);     chargerecord.setcreatetime(new date());     chargerecordmapper.insertselective(chargerecord);     int = 4/0;     return result; } 

log

problems: 1.can' t rollback success; 2.why datasource init twice.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -