0

A table my_table should have a generated class named MyTable. How do I get the table name, my_table, from Cayenne while having access to MyTable?

I'm not looking for snake_case <=> CamelCase that kind of approach. I'm looking for something like MyTable.TABLE_NAME (not exists) or Cayenne.getTableName(MyTable.class) (not exists either).

(using Cayenne 4.2.RC2)

Vin
  • 559
  • 2
  • 18

1 Answers1

0

You can get it from Cayenne metadata:

String tableName = objectContext
  .getEntityResolver()
  .getObjEntity(MyTable.class)
  .getDbEntityName();
andrus_a
  • 2,528
  • 1
  • 16
  • 10