0

したがって、次のようなカスタムIDを持つモデルがあります。

@Entity
public class SomeModel extends Model {

    @Id
    @Unique
    @Required
    public String myOwnId;

    @Required
    public String someOtherField;

    public SomeModel(final String myOwnId, final String someOtherField) {
        this.myOwnId = myOwnId;
        this.someOtherField = someOtherField;
    }

} 

そして、次のようなinitial-data.ymlファイルがあります。

SomeModel(myModel):
  myOwnId: "someID"
  someOtherField: "some value here"

ただし、これは機能しませんRuntimeException occured : Cannot load fixture initial-data.yml: org.hibernate.PropertyAccessException: could not set a field value by reflection setter of models.SomeModel.id。これに対する素晴らしくて簡単な解決策はありますか?

4

1 に答える 1

0

わかりました、悪いですが、実際には機能しますが、モデルクラスGenericModelではなく、 を拡張する必要があります。Model

于 2013-02-11T13:48:46.280 に答える