jt-20180528 / pro_document_mycat

项目文档记录,一些技术栈预研文档
2 stars 1 forks source link

jpa不支持mycat1.6.5支持sql注解方案的问题 #17

Open lujunGit opened 6 years ago

lujunGit commented 6 years ago

jpa不支持mycat1.6.5支持sql注解方案的问题:

EXPLAIN /*!mycat:sql=select COUNT(1) from t_bet_order where TENANT_CODE=111101*/ 
UPDATE 
  t_bet_order AS b 
  INNER JOIN t_bet_order_data AS td 
    ON b.id = td.id 
    AND td.Lottery_number_id = 1
                SET b.WIN_STATUS = td.win_status,
  b.LOTTERY_NUMBER = td.LOTTERY_NUMBER,
  b.odds = td.odds,
  b.WIN_AMOUNT = td.win_amount,
  b.WIN_SECRET = td.win_secret,
  b.WIN_COUNT = td.win_count 

mycat文档规定可以这样添加注解定位到具体执行sql的库表,但是jsp事务拦截器不支持报错:

could not execute native bulk manipulation query; nested exception is org.hibernate.exception.GenericJDBCException: could not execute 
native bulk manipulation query
lujunGit commented 6 years ago

已经修改了mycat的源代码,在mycat sql语句第一次进入时,做拦截过滤,再次重新组织注解,使其按照mycat流程执行。