Is there a simple way to retrieve table metadata (e.g. primary key and foreign keys) from a relational database, via Hibernate
?
There are numerous XInformation
interfaces in the package org.hibernate.tool.schema.extract.spi
(e.g., TableInformation
, PrimaryKeyInformation
, ForeignKeyInformation
), as well as an InformationExtractor
interface, but no documented ways of how to instantiate them from a database session.
Using plain vanilla JSBC
allows the retrieval of the metadata via
DatabaseMetaData metadata = connection.getMetaData();
Apparently the corresponding mechanism in Hibernate 5
is to register an org.hibernate.integrator.spi.Integrator
object in the properties used to create SessionFactory
objects to connect to the database, as discussed in this questiοn:
Is there any way of getting the above information as in JDBC, i.e. without modifying the session configuration?