2

I have a database type called "foo", defined like:

CREATE TYPE foo AS ENUM('foo','bar','baz');

And when I generate classes for my tables via the Apache Cayenne Modeler, I get an error saying that that field is undefined. Come to find out, there is no type generated for this field.

How do I implement postgresql enumeration types on the java side so Cayenne handles them properly?

1 Answers1

1

While Cayenne should've done a better job guessing a type for the enum, you can easily fix that yourself. In the CayenneModeler change the column type of DbEntity to VARCHAR. On the ObjEntity side you can map it as a String, or you can create a Java enum to match your DB enum, and map to that.

andrus_a
  • 2,528
  • 1
  • 16
  • 10