zoukankan      html  css  js  c++  java
  • FreeMarker / S2SH 各种报错解决方案

    1. org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of com.fcms.core.entity.NubbMovie.isMovie  

    持久化对象-映射文件-数据库表中对应字段数据类型不符

    2. freemarker.core.ParseException: Encountered "" at line 187, column 49 in WEB-INF/user_base/face_com_www/tuike/movie/actor.html. Was expecting one of: ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... "${" ... "#{" ...

    标签错误,可能是由于</#list>写成了<#/list>  不合法造成无法解析而报错

    3. freemarker.core.ParseException: Unexpected end of file reached. Unclosed list directive.

     Unclosed list---<#list>未含结束标签

    4. org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of

    对应bean中set方法数据类型和hibernate配置文件中定义的类型是否一致。

    5.org.hibernate.exception.SQLGrammarException: could not initialize a collection 

    检查以下内容是否出错:

    inverse="true" 是否在一对多或多对多中设定一方去维持两者之间的关系; 或者用注解的方式配置则是:

    //One
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "movie_id", cascade = {
       CascadeType.PERSIST, CascadeType.REFRESH }, targetEntity = Users.class)
     @Column(name = "movie_id", nullable = false, updatable = false)
    //Many
    @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "movie", insertable = true, updatable = true, nullable = false)

    cascade="delete" 级联删除

    <key>
      <column name="movie_id" /> 此处应填上另一方表的字段名!
    </key>

    6.  freemarker 中在一循环列表中,判断某条记录是否包含指定的字符串。

      <#list al as l>
        <#if l.info?indexof("xxx") != -1>
          ${l.name!}
        </#if>
      </#list>

      本以为很简单的一个逻辑判断语句,但是在实际操作中,指定的字符串“xxx”,不是已知的,而是一个变量,这里我就用str表示

      那么l.info?indexof(str) != -1 这条语句将会报args参数错误! 原因在于传递进来的str类型不是string

      在此i.info?indexof("str") != -1 不会报错,但是很明显,这样的话str变量将不会被解析。

      为了达到逻辑语句成立,我只能在l.info那做文章---将每个元素用 , 隔开,然后将indexof()判断的字符串改变,得到indexof("," + str + ",");

      此时有人会提出,我可以直接写成这样就行了啊----indexof(""" + str +""");   答案是否定的

    7. No row with the given identifier exists: org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.fcms.cms.entity.CmsChannel#1679]

      

  • 相关阅读:
    如何理解volatile关键字
    Spring 4+JMS+ActiveMQ Example with Annotations
    Spring MVC如何获得客户端IP地址
    PDFBox –如何读取PDF的内容
    Spring MVC 使用Ehcache作为缓存的例子
    自定义了一个data table控件
    Linux基本配置
    位操作学习
    QT——QPainter类详解
    QT——设计文件的和控制类的关联问题
  • 原文地址:https://www.cnblogs.com/xmaomao/p/3208018.html
Copyright © 2011-2022 走看看