0

ブロブデータ型でextendsGenericModelを使用しようとしていますが、エラーが発生します。

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を削除しても、エラーは発生しません。問題の原因は何ですか?

すべての助けを歓迎します。

ありがとう!

4

1 に答える 1

1

あなたの問題はブロブにあるとは思いませんが、非標準のID名を処理するCRUDモジュールにあります。

あなたの例では、crudモジュールは「currentObject?.id」を取得しようとしますが、ID名は「news_id」です

「news_id」フィールドの名前を「id」に変更してみてください

于 2012-10-05T14:35:02.620 に答える