-
public interface PersistenceUnitInfo
Interface implemented by the container and used by the persistence provider when creating anEntityManagerFactory
.- Since:
- Java Persistence 1.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description 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 thegetClassLoader()
method.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.ClassLoader
getClassLoader()
Returns ClassLoader that the provider may use to load any classes, resources, or open URLs.List<URL>
getJarFileUrls()
Returns a list of URLs for the jar files or exploded jar file directories that the persistence provider must examine for managed classes of the persistence unit.DataSource
getJtaDataSource()
Returns the JTA-enabled data source to be used by the persistence provider.List<String>
getManagedClassNames()
Returns the list of the names of the classes that the persistence provider must add to its set of managed classes.List<String>
getMappingFileNames()
Returns the list of the names of the mapping files that the persistence provider must load to determine the mappings for the entity classes.ClassLoader
getNewTempClassLoader()
Return a new instance of a ClassLoader that the provider may use to temporarily load any classes, resources, or open URLs.DataSource
getNonJtaDataSource()
Returns the non-JTA-enabled data source to be used by the persistence provider for accessing data outside a JTA transaction.String
getPersistenceProviderClassName()
Returns the fully qualified name of the persistence provider implementation class.String
getPersistenceUnitName()
Returns the name of the persistence unit.URL
getPersistenceUnitRootUrl()
Returns the URL for the jar file or directory that is the root of the persistence unit.String
getPersistenceXMLSchemaVersion()
Returns the schema version of thepersistence.xml
file.Properties
getProperties()
Returns a properties object.SharedCacheMode
getSharedCacheMode()
Returns the specification of how the provider must use a second-level cache for the persistence unit.PersistenceUnitTransactionType
getTransactionType()
Returns the transaction type of the entity managers created by theEntityManagerFactory
.ValidationMode
getValidationMode()
Returns the validation mode to be used by the persistence provider for the persistence unit.
-
-
-
Method Detail
-
getPersistenceUnitName
String getPersistenceUnitName()
Returns the name of the persistence unit. Corresponds to thename
attribute in thepersistence.xml
file.
- Returns:
- the name of the persistence unit
-
getPersistenceProviderClassName
String getPersistenceProviderClassName()
Returns the fully qualified name of the persistence provider implementation class. Corresponds to theprovider
element in thepersistence.xml
file.- Returns:
- the fully qualified name of the persistence provider implementation class
-
getTransactionType
PersistenceUnitTransactionType getTransactionType()
Returns the transaction type of the entity managers created by theEntityManagerFactory
. The transaction type corresponds to thetransaction-type
attribute in thepersistence.xml
file.- Returns:
- transaction type of the entity managers created by the EntityManagerFactory
-
getJtaDataSource
DataSource getJtaDataSource()
Returns the JTA-enabled data source to be used by the persistence provider. The data source corresponds to thejta-data-source
element in thepersistence.xml
file or is provided at deployment or by the container.- Returns:
- the JTA-enabled data source to be used by the persistence provider
-
getNonJtaDataSource
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 namednon-jta-data-source
element in thepersistence.xml
file or provided at deployment or by the container.- Returns:
- the non-JTA-enabled data source to be used by the persistence provider for accessing data outside a JTA transaction
-
getMappingFileNames
List<String> getMappingFileNames()
Returns the list of the names of the mapping files 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 amapping-file
element in thepersistence.xml
file.- Returns:
- the list of mapping file names that the persistence provider must load to determine the mappings for the entity classes
-
getJarFileUrls
List<URL> getJarFileUrls()
Returns a list of URLs for the jar files or exploded jar file directories that the persistence provider must examine for managed classes of the persistence unit. Each URL corresponds to ajar-file
element in thepersistence.xml
file. A URL will either be a file: URL referring to a jar file or referring to a directory that contains an exploded jar file, or some other URL from which an InputStream in jar format can be obtained.- Returns:
- a list of URL objects referring to jar files or directories
-
getPersistenceUnitRootUrl
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.) The URL will either be a file: URL referring to a jar file or referring to a directory that contains an exploded jar file, or some other URL from which an InputStream in jar format can be obtained.- Returns:
- a URL referring to a jar file or directory
-
getManagedClassNames
List<String> getManagedClassNames()
Returns the list of the names of the classes that the persistence provider must add to its set of managed classes. Each name corresponds to a namedclass
element in thepersistence.xml
file.- Returns:
- the list of the names of the classes that the persistence provider must add to its set of managed classes
-
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 theexclude-unlisted-classes
element in thepersistence.xml
file.- 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
-
getSharedCacheMode
SharedCacheMode getSharedCacheMode()
Returns the specification of how the provider must use a second-level cache for the persistence unit. The result of this method corresponds to theshared-cache-mode
element in thepersistence.xml
file.- Returns:
- the second-level cache mode that must be used by the provider for the persistence unit
- Since:
- Java Persistence 2.0
-
getValidationMode
ValidationMode getValidationMode()
Returns the validation mode to be used by the persistence provider for the persistence unit. The validation mode corresponds to thevalidation-mode
element in thepersistence.xml
file.- Returns:
- the validation mode to be used by the persistence provider for the persistence unit
- Since:
- Java Persistence 2.0
-
getProperties
Properties getProperties()
Returns a properties object. Each property corresponds to aproperty
element in thepersistence.xml
file or to a property set by the container.- Returns:
- Properties object
-
getPersistenceXMLSchemaVersion
String getPersistenceXMLSchemaVersion()
Returns the schema version of thepersistence.xml
file.- Returns:
- persistence.xml schema version
- Since:
- Java Persistence 2.0
-
getClassLoader
ClassLoader getClassLoader()
Returns ClassLoader that the provider may use to load any classes, resources, or open URLs.- 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 thegetClassLoader()
method. The transformer has no effect on the result returned by thegetNewTempClassLoader()
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
- provider-supplied transformer that the container invokes at class-(re)definition time
-
getNewTempClassLoader
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 bygetClassLoader()
. None of the classes loaded by this class loader will be visible to application components. The provider may only use this ClassLoader within the scope of thePersistenceProvider.createContainerEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo, java.util.Map)
call.- Returns:
- temporary ClassLoader with same visibility as current loader
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
21/08/2025 19:09:39 Cette version de la page est en cache (à la date du 21/08/2025 19:09:39) afin d'accélérer le traitement.Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la version plus récente de la page.
Document créé le 19/04/2008, dernière modification le 18/08/2025
Source du document imprimé : https://www.gaudry.be/java-api-javaee-rf-javax/persistence/spi/PersistenceUnitInfo.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.