views:

19

answers:

1

My EntityManager is using a persistence unit that uses a data source provided by our Websphere configuration. The DS configuration includes an environment specific DB to use.

The EM successfully uses this schema, but I can't figure out a way to log or display the schema being used. I was thing something like em.getCurrentSchema would be available..

Any help would be great, thanks.

+1  A: 

No API to do this (in JPA). You could do it via JDBC and use of DatabaseMetaData.

JPA is to provide an object view of the data and ease persistence of those objects, not to just present datastore specifics to the user.

DataNucleus
Fair enough. Is there also no way to coax that info from the Persitence Unit or even the Persitence.xml file?
Eddie
By "schema" you just mean the schema name ? or information about the RDBMS schema ? There is no JPA way for either; JDO is the only persistence API that provides access to the metadata information. For the schema name, you would have to do it in an implementation-specific way; DataNucleus certainly provides access to it, and I'm sure others do to.
DataNucleus