Playframework 重头戏1.2.5-使用自定义ID加载初始数据

Playframework 重头戏1.2.5-使用自定义ID加载初始数据,playframework,yaml,Playframework,Yaml,因此,我有一个带有自定义ID的模型,类似这样: @实体 公共类模型扩展模型{ @身份证 @独特的 @必需的 公共字符串myOwnId; @必需的 公共字符串someOtherField; public SomeModel(最终字符串myOwnId,最终字符串someOtherField){ this.myOwnId=myOwnId; this.someOtherField=someOtherField; } } 我有一个initial-data.yml文件,如下所示: SomeModel(m

因此,我有一个带有自定义ID的模型,类似这样:

@实体
公共类模型扩展模型{
@身份证
@独特的
@必需的
公共字符串myOwnId;
@必需的
公共字符串someOtherField;
public SomeModel(最终字符串myOwnId,最终字符串someOtherField){
this.myOwnId=myOwnId;
this.someOtherField=someOtherField;
}
} 
我有一个initial-data.yml文件,如下所示:

SomeModel(myModel):
myOwnId:“someID”
someOtherField:“此处的某些值”

但是,这不起作用:
RuntimeException发生:无法加载fixture initial-data.yml:org.hibernate.PropertyAccessException:无法通过模型的反射setter设置字段值。SomeModel.id
。有什么好的简单的解决方案吗?

好的,我的坏消息,它实际上是有效的,但是,您必须用模型类扩展
GenericModel
,而不是
Model