Getting a list of all the entity class names


I was wondering if there is any way to get a list of the entity names in the database?


You can use the Metamodel API as explained by the JPA Metamodel API page in the manual.

ObjectDB Support

Actually, there is a simpler way to get the class names (in one line of code).

It requires a JDO' s PersistenceManager:

  String[] classNames = com.objectdb.Utilities.getClassNames(pm);

In JPA you have to unwrap the EntityManager as a JDO PersistenceManager:

  String[] classNames =

This method remained from ObjectDB 1.x, but in JPA 2 applications the JPA Metamodel API should be preferred because it is portable and provide better functionality (for example you can use it to get entity names or class names - which is not the same).

ObjectDB Support