【问题标题】:ormlite - no field annotation in the case of object array referenceormlite - 在对象数组引用的情况下没有字段注释
【发布时间】:2013-12-04 17:12:58
【问题描述】:

我正在使用 ormlite 4.46。

对于以下场景,我收到错误“java.lang.IllegalArgumentException: No fields have a DatabaseField annotation in class [xx.xx.xx]”,

@DatabaseTable(tableName="AClass") 
class A{ 
      @DatabaseField(generatedId = true, columnName = "_id")      
      private int id;

      @DatabaseField(foreign = true, foreignAutoCreate = true, canBeNull = true, foreignAutoRefresh = true) 
      @JsonProperty("bproperty")
      private B[] bObjects;

    }     

     @DatabaseTable(tableName="BClass")
     class B{
          @DatabaseField(generatedId = true, columnName = "_id")      
          private int id;
      } 

对我们如何处理这种情况有任何想法吗?

提前致谢,

JRH

【问题讨论】:

    标签: android ormlite


    【解决方案1】:

    对于以下场景,我收到错误“java.lang.IllegalArgumentException: No fields have a DatabaseField annotation in class [xx.xx.xx]”,

    我不太明白为什么会显示此错误。可能是没有正确生成数据库表配置文件?它可能会抛出异常,因为您无法使用 ORMLite 持久化元素数组。

    您能否尝试重新生成数据库表配置文件并注意异常情况?

    【讨论】:

      猜你喜欢
      • 2018-11-03
      • 1970-01-01
      • 2018-02-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-17
      相关资源
      最近更新 更多