我正在尝试使用带有blob数据类型的extends GenericModel但是收到错误:
Execution error occured in template
{module:crud}/app/views/tags/crud/form.html. Exception raised was
MissingPropertyException : No such property: id for class: models.Member.
In {module:crud}/app/views/tags/crud/form.html (around line 56)
#{crud.passwordField name:field.name, value:(currentObject ? currentObject[field.name] : null) /}
#{/if}
#{if field.type == 'binary'}
#{crud.fileField name:field.name, value:(currentObject ? currentObject[field.name] : null), id:currentObject?.id /}
#{/if}
#{if field.type == 'longtext'}
#{crud.longtextField name:field.name, value:(currentObject ? currentObject[field.name] : null) /}
#{/if}
我的模特是:
@Entity
@Table(name = "news_feed")
public class NewsFeed extends GenericModel {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long news_id;
public Blob news_image;
...
}
如果删除extends GenericModel
或删除blob,我不会收到错误。是什么导致了这个问题?
欢迎所有帮助。
谢谢!
答案 0 :(得分:1)
我认为您的问题不在于blob,而在于CRUD模块处理非标准ID名称。
在您的示例中,crud模块尝试获取" currentObject?.id"但你的身份名称是" news_id"
尝试重命名你的" news_id"字段到" id"