If you still have access to the Hibernate Configuration object, you can do this:
for (Iterator iter=configuration.getClassMappings(); iter.hasNext();) {
PersistentClass persistentClass = (PersistentClass)iter.next();
String table = persistentClass.getTable().getName();
}
It is assumed that you have one table for each object, and you only care about the tables that are displayed. Otherwise, you probably need to do something with the base connection and DatabaseMetaData, for example:
session.connection().getMetaData().getTables(catalog, schemaPattern, tableNamePattern, types)
source
share