How to solve “Error generating PK : entity not supported” when using Cayenne

StackOverflow https://stackoverflow.com/questions/4785154

  •  24-10-2019
  •  | 
  •  

문제

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?

도움이 되었습니까?

해결책 2

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.

  • If the value is supposed to be auto-generated, tell Cayenne how to generate the value.
  • If it is not supposed to be generated, provide a value before committing changes in the context.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top