1

    xiaoxiao2021-03-25  91

    1在 今天弄hiberanate 实例化对象之后,数据库的 tingyint  所以生成的实例的是short  类型  然后我改成 int  结果一直报错说是not  column 错 ,并且是个String 字段 重新映射一遍就好了 ,很奇怪

    2在本地测试全程无错,当上传服务器端,插入数据时说 trastion not sucess begin ,然后 在查询时也报错 找不到 texstfly.errdc 表,这其实是本地的数据库才叫testfly,重新连接 服务器端的jdbc ,重新用hibernate 实例化 映射对象一遍 ,所有问题全部解决。

    有时候,一个bug解决不了,先放放,再回头可能就解决了。 神清气爽啊是。。。。

    3.关于 struts 2和hibernate 的乱码问题 

    struts2   方面  <constant name="struts.i18n.encoding" value="UTF-8" />

    x写了个 过滤器 public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { // TODO Auto-generated method stub  request.setCharacterEncoding("utf-8");        // 传递控制到下一个过滤器      chain.doFilter(request, response);   }

    web.xml 的配置

     <filter>           <filter-name>SetCharacterEncoding</filter-name>            <filter-class>filter.SetCharacterEncodingFilter</filter-class>        </filter>        <filter-mapping>            <filter-name>SetCharacterEncoding</filter-name>           <url-pattern>/*</url-pattern>        </filter-mapping>  

    hibernate  方面url 设置 jdbc:mysql://localhost:3306/testfly?useUnicode=true&characterEncoding=utf8  

    mysql  的delete 语句多表删除  "DELETE alldatas a ,errorqianfly e ,errorzhifly e1"   +" FROM alldatas a ,errorqianfly e , errorzhifly e1"   +" where a.account = e.account"   +" and e.account=e1.account"   +" and a.proid=:proid and a.account=:account";

    转载请注明原文地址: https://ju.6miu.com/read-10805.html

    最新回复(0)