我有两个类如下:
@Getter
@Setter
@NoArgsConstructor
@DatabaseTable(tableName = "condicao_ambiental")
public class CondicaoAmbiental {
@Expose
@DatabaseField(id = true, columnName = "id")
private UUID id;
@Expose
@DatabaseField(dataType = DataType.DATE_LONG)
private Date dataCriacao;
@Expose
@DatabaseField(columnName = "idUsuario", foreign = true, foreignAutoRefresh = true)
private Usuario usuario;
...
}
和
@Getter
@Setter
@NoArgsConstructor
@DatabaseTable(tableName = "usuario")
public class Usuario {
@Expose
@DatabaseField(id = true, columnName = "id")
private UUID id;
@DatabaseField(foreign = true, columnName = "idCliente")
private Cliente cliente;
@DatabaseField
private String nome;
@DatabaseField
private String login;
private String senha;
...
}
这些类中使用的注释来自Lombok
,Retrofit2
和OrmLite5
当我查询列出CondicaoAmbiental
时,会出现此错误:
java.sql.SQLException: Unknown field 'senha' from the Android sqlite cursor, not in:[id, idCliente, nome, tipoSindicato, dataCadastro, diasTeste]
但是列senha
未注释为字段。
当我查询列出Usuario
时,一切运行正常并且列表已加载。
如果我从字段foreignAutoRefresh=true
中删除usuario
,则不会发生错误。
有人能告诉我我错过了什么吗?