spring 的定时器, 应该可以完成对数据库的增删改查, 应该是你配置的方法有问题, 看看你的事务是否在定时任务中开启。
/**
* 任务执行方法
*/
@Scheduled(cron="0 5 * * * ?")
@Transactional
public void execute() {
Thread current = Thread.currentThread();
Date startTime = new Date();
log.info("活动状态变更 [Thread id : " + current.getId() + ", Thread name : " + current.getName() + "] : 执行开始, 时间 : " + DateUtils.formateDate(startTime, "yyyy-MM-dd HH:ss:mm.SSS"));
this.updateActivity(startTime);
Date endTime = new Date();
log.info("活动状态变更 [Thread id : " + current.getId() + ", Thread name : " + current.getName() + "] : 执行结束, 时间 : " + DateUtils.formateDate(endTime, "yyyy-MM-dd HH:ss:mm.SSS") + ", 耗时 : " + (endTime.getTime() - startTime.getTime()) + " ms");
}