したがって、次のようなカスタム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
。これに対する素晴らしくて簡単な解決策はありますか?