操作步骤(严格按照步骤,1、2,3、5,一步不能少):
1、启动事务:
boolean transStart()
boolean transStart(String ISOLATION_LEVEL)//指定SESSION事务隔离级别,参数为:READ UNCOMMITTED、READ COMMITTED、REPEATABLE READ、SERIALIZABLE
boolean transStart(Model ...models)//多个模型参与事务执行
boolean transStart(String ISOLATION_LEVEL,Model ...models)//指定SESSION事务隔离级别及多个模型参与事务执行
2、执行事务:
int transQuery(String sqlkey,HashMap<String,Object> params)
int transInsert(String sqlkey,HashMap<String,Object> params)
int transReplace(String sqlkey,HashMap<String,Object> params)
int transPreQuery(String sqlkey,HashMap<Integer,Object> params)
int sql(String sqlkey,HashMap<String,Object> params).transInsert()
int sql(String sqlkey,HashMap<String,Object> params).transReplace()
int sql(String sqlkey,HashMap<String,Object> params).transDrop()
int sql(String sqlkey,HashMap<String,Object> params).transUpdate()
int sql(String sqlkey).transPrepareInsert(HashMap<Integer,Object> params)
int[] sql(String sqlkey).transPrepareBatchInsert(ArrayList<HashMap<Integer,Object>> params)
int sql(String sqlkey).transPrepareReplace(HashMap<Integer,Object> params)
int[] sql(String sqlkey).transPrepareBatchReplace(ArrayList<HashMap<Integer,Object>> params)
int sql(String sqlkey).transPrepareUpdate(HashMap<Integer,Object> params)
int[] sql(String sqlkey).transPrepareBatchUpdate(ArrayList<HashMap<Integer,Object>> params)
int sql(String sqlkey).transPrepareDrop(HashMap<Integer,Object> params)
int[] sql(String sqlkey).transPrepareBatchDrop(ArrayList<HashMap<Integer,Object>> params)
3、提交事务
transCommit()
4、回滚事务(如果有异常,此步才需要)
transRollback()
5、结束事务
transEnd()