所以,我有一个带有自定义 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
. 有什么好的和简单的解决方案吗?