Question

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?

Was it helpful?

Solution 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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top