• 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]

      

  • 相关阅读:
    编译原理-确定有穷自动机(deterministic finite automata ,DFA)
    编译原理-正规式和正规集
    linux之sed用法
    Linux 中find命令
    运维工作应该掌握哪些技能?
    Last_SQL_Error: Error 'Can't drop database
    关于在centos下安装python3.7.0以上版本时报错ModuleNotFoundError: No module named '_ctypes'的解决办法
    python3.7安装, 解决pip is configured with locations that require TLS/SSL问题
    Linux date命令的用法(转)
    MySQL回滚到某一时刻数据的方法
  • 原文地址:https://www.cnblogs.com/xmaomao/p/3208018.html
Copyright © 2020-2023  润新知