zoukankan      html  css  js  c++  java
  • mysql存入数据出错总结

    ELECT t0.accusation_des, t0.submit_time, t0.result, t0.handle_time, t1.content,
                    t4.nick_name,t5.content,t6.ask_title ,t7.state_name,t8.item_name,t9.school_name,t10.school_name,t12.school_name,t14.school_name
                    FROM wxcommunity.t_accusation t0 
                    left join wxcommunity.t_comment t1 on t1.commentId = t0.commentId 
                    LEFT JOIN wxcommunity.t_ask t2 ON t2.askId = t1.askId
                    LEFT JOIN wxcommunity.t_school t9 ON t9.schoolId = t2.schoolId
                    LEFT JOIN wxcommunity.t_answer t3 ON t1.answer_id = t3.answer_id
                    LEFT JOIN wxcommunity.t_ask t11 on t11.askId = t3.askId
                    LEFT JOIN wxcommunity.t_school t12 ON t12.schoolId = t11.schoolId
                    LEFT JOIN wxcommunity.t_member t4 ON t4.userid = t0.userid 
                    left join wxcommunity.t_answer t5 on t5.answer_id = t0.answer_id
                    LEFT JOIN wxcommunity.t_ask t13 on t13.askId = t5.askId
                    LEFT JOIN wxcommunity.t_school t14 ON t14.schoolId = t13.schoolId
                    LEFT JOIN wxcommunity.t_ask t6 on t6.askId = t0.askId
                    LEFT JOIN wxcommunity.t_school t10 ON t10.schoolId = t6.schoolId
                    LEFT JOIN wxcommunity.t_handle_state t7 on t7.stateId = t0.stateId
                    LEFT JOIN wxcommunity.t_accusation_item t8 on t8.accusation_item_id = t0.accusation_item_id
                    WHERE (t0.askId > 0  OR  t0.answer_id > 0 OR t1.askId > 0 OR t1.answer_id > 0)

    总结:1,带有or逻辑关系的sql语句jpa查询出错,初步判断jpa本身bug。

            2,上述语句在数据库中直接查询(navicat执行sql语句)没问题,但是用在java代码中执行 executeNativeSql()出错,开始时因mysql-connector-java查询出错查不出数据,换了一个mysql-connector-java5.1.30的能查出数据但是还是有错(查询记录老是少了一条)。初步判断java代码中mysql-connector-java驱动本身缺陷。

  • 相关阅读:
    复数加法
    通过函数来实现复数相加
    声明一个类模板
    友元成员函数的简单应用
    将普通函数声明为友元函数
    引用静态数据成员
    对象的赋值
    对象的常引用
    有关对象指针的使用方法
    对象数组的使用方法
  • 原文地址:https://www.cnblogs.com/weilantiankong/p/4643315.html
Copyright © 2011-2022 走看看