How to retrieve mapping table name for an entity in JPA at runtime?
07:33 26 Feb 2010

Is it possible to determine the native table name of an entity?

If a Table annotation is present it's easy:

entityClass.getAnnotation(Table.class).name()

But what about if no Table annotation is present?

Hibernate provides this information via the Configuration class:

configuration.getClassMapping(entityClass.getSimpleName()).getTable().getName()

Is there something similar in JPA?

java jpa entity