[英]serializable string in hibernate save(Object entity, Serializable id)
I want to persist using a specific id- String tdsSubmissionId; 我想坚持使用特定的id-String tdsSubmissionId; Myclass myclass;
Myclass myclass; this.hibernateTemplate.save(myclass, tdsSubmissionId);
this.hibernateTemplate.save(myclass,tdsSubmissionId);
using this signature- save(Object entity, Serializable id) 使用此签名保存(对象实体,Serializable id)
but I get the error- the method save(String, Object) is not applicable for the arguments (Myclass, String) 但我得到错误 - 方法save(String,Object)不适用于参数(Myclass,String)
Seems like it's being autotyped incorrectly. 好像它被错误地自动定型了。 How can I fix it?
我该如何解决? Thanks.
谢谢。
There is no such method as save(entity, id)
, and that's what the error is telling you. 没有像
save(entity, id)
这样的方法,这就是错误告诉你的。
Your entity must already have the ID set, and you can pass it to hibernateTemplate.save(entity)
. 您的实体必须已经设置了ID,您可以将其传递给
hibernateTemplate.save(entity)
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.