javax.persistence.spi
Interface PersistenceUnitInfo
- All Known Implementing Classes:
- JPersistenceUnitInfo
public interface PersistenceUnitInfo
Interface implemented by the container and used by the persistence provider
when creating an EntityManagerFactory.
- Since:
- EJB 3.0 version.
- Author:
- Florent Benoit
- See Also:
- EJB 3.0 specification
getPersistenceUnitName
java.lang.String getPersistenceUnitName()
- Returns:
- The name of the persistence unit. Corresponds to the <name>
element in the persistence.xml file.
getPersistenceProviderClassName
java.lang.String getPersistenceProviderClassName()
- Returns:
- The fully qualified name of the persistence provider
implementation class. Corresponds to the <provider> element
in the persistence.xml file.
getTransactionType
PersistenceUnitTransactionType getTransactionType()
- Returns:
- The transaction type of the entity managers created by the
EntityManagerFactory. The transaction type corresponds to the
transaction-type attribute in the persistence.xml file.
getJtaDataSource
javax.sql.DataSource getJtaDataSource()
- Returns:
- The JTA-enabled data source to be used by the persistence
provider. The data source corresponds to the
<jta-data-source> element in the persistence.xml file or is
provided at deployment or by the container.
getNonJtaDataSource
javax.sql.DataSource getNonJtaDataSource()
- Returns:
- The non-JTA-enabled data source to be used by the persistence
provider for accessing data outside a JTA transaction. The data
source corresponds to the named <non-jta-data-source>
element in the persistence.xml file or provided at deployment or
by the container.
getMappingFileNames
java.util.List<java.lang.String> getMappingFileNames()
- Returns:
- The list of mapping file names that the persistence provider must
load to determine the mappings for the entity classes. The
mapping files must be in the standard XML mapping format, be
uniquely named and be resource-loadable from the application
classpath. Each mapping file name corresponds to a
<mapping-file> element in the persistence.xml file.
getJarFileUrls
java.util.List<java.net.URL> getJarFileUrls()
- Returns:
- The list of JAR file URLs that the persistence provider must
examine for managed classes of the persistence unit. Each jar
file URL corresponds to a named <jar-file> element in the
persistence.xml file.
getPersistenceUnitRootUrl
java.net.URL getPersistenceUnitRootUrl()
- Returns:
- The URL for the jar file or directory that is the root of the
persistence unit. (If the persistence unit is rooted in the
WEB-INF/classes directory, this will be the URL of that
directory.)
getManagedClassNames
java.util.List<java.lang.String> getManagedClassNames()
- Returns:
- The list of the names of the classes that the persistence
provider must add it to its set of managed classes. Each name
corresponds to a named <class> element in the
persistence.xml file.
excludeUnlistedClasses
boolean excludeUnlistedClasses()
- Returns:
- Whether classes in the root of the persistence unit that have not
been explicitly listed are to be included in the set of managed
classes. This value corresponds to the
<exclude-unlisted-classes> element in the persistence.xml
file.
getProperties
java.util.Properties getProperties()
- Returns:
- Properties object. Each property corresponds to a
<property> element in the persistence.xml file
getClassLoader
java.lang.ClassLoader getClassLoader()
- Returns:
- ClassLoader that the provider may use to load any classes,
resources, or open URLs.
addTransformer
void addTransformer(ClassTransformer transformer)
- Add a transformer supplied by the provider that will be called for every
new class definition or class redefinition that gets loaded by the loader
returned by the PersistenceInfo.getClassLoader method. The transformer
has no effect on the result returned by the
PersistenceInfo.getTempClassLoader method. Classes are only transformed
once within the same classloading scope, regardless of how many
persistence units they may be a part of.
- Parameters:
transformer
- A provider-supplied transformer that the Container
invokes at class-(re)definition time
getNewTempClassLoader
java.lang.ClassLoader getNewTempClassLoader()
- Return a new instance of a ClassLoader that the provider may use to
temporarily load any classes, resources, or open URLs. The scope and
classpath of this loader is exactly the same as that of the loader
returned by PersistenceInfo.getClassLoader. None of the classes loaded by
this class loader will be visible to application components. The
container does not use or maintain references to this class loader after
returning it to the provider.
- Returns:
- Temporary ClassLoader with same visibility as current loader