如何解决“生成 PK 时出错:不支持实体”使用卡宴时
当向 Apache Cayenne 上下文提交更改时,我收到如下异常。
org.apache.cayenne.CayenneRuntimeException: [v.3.0.1 Sep 06 2010 15:09:38]
Error generating PK : entity not supported: SOME_TABLE
为什么会出现这种情况?
When committing changes to an Apache Cayenne context, I get an exception like the following.
org.apache.cayenne.CayenneRuntimeException: [v.3.0.1 Sep 06 2010 15:09:38]
Error generating PK : entity not supported: SOME_TABLE
Why does this happen?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要在 Cayenne modeler 中设置密钥生成策略。文档可以在 Cayenne 参考中找到。
通常,Cayenne 不会在对象实体类中向用户公开 PK。你可以忽略它,但在让你的 PK 有意义之前要仔细考虑。
You need to set a key generation strategy in Cayenne modeler. Documentation can be found in the Cayenne reference.
Normally Cayenne does not expose the PK to the user in the Object Entity classes. You can override that, but think very carefully before you make your PK meaningful.
作为 SOME_TABLE 主键一部分的列没有值。因此 Cayenne 尝试生成一个,但不知道如何生成。
要解决该问题,请执行以下操作之一。
A column that is part of the primary key of SOME_TABLE has no value. Therefore Cayenne tries to generate one, but does not know how to.
To solve the problem, do one of the following.