Class Persistence.PersistenceUnit
- Enclosing class:
Persistence
Java class for anonymous complex type
.The following schema fragment specifies the expected content contained within this class.
<complexType>
<complexContent>
<restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
<sequence>
<element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
<element name="provider" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
<element name="jta-data-source" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
<element name="non-jta-data-source" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
<element name="mapping-file" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
<element name="jar-file" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
<element name="class" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
<element name="exclude-unlisted-classes" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
<element name="shared-cache-mode" type="{https://jakarta.ee/xml/ns/persistence}persistence-unit-caching-type" minOccurs="0"/>
<element name="validation-mode" type="{https://jakarta.ee/xml/ns/persistence}persistence-unit-validation-mode-type" minOccurs="0"/>
<element name="properties" minOccurs="0">
<complexType>
<complexContent>
<restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
<sequence>
<element name="property" maxOccurs="unbounded" minOccurs="0">
<complexType>
<complexContent>
<restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
<attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
<attribute name="value" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
</restriction>
</complexContent>
</complexType>
</element>
</sequence>
</restriction>
</complexContent>
</complexType>
</element>
</sequence>
<attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
<attribute name="transaction-type" type="{https://jakarta.ee/xml/ns/persistence}persistence-unit-transaction-type" />
</restriction>
</complexContent>
</complexType>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Java class for anonymous complex type -
Field Summary
FieldsModifier and TypeFieldDescriptionManaged class to be included in the persistence unit and to scan for annotations.protected String
Description of this persistence unit.protected Boolean
When set to true then only listed classes and jars will be scanned for persistent classes, otherwise the enclosing jar or directory will also be scanned.Jar file that is to be scanned for managed classes.protected String
The container-specific name of the JTA datasource to use.File containing mapping information.protected String
Name used in code to reference this persistence unit.protected String
The container-specific name of a non-JTA datasource to use.protected Persistence.PersistenceUnit.Properties
A list of standard and vendor-specific properties and hints.protected String
Provider class that supplies EntityManagers for this persistence unit.protected PersistenceUnitCachingType
Defines whether caching is enabled for the persistence unit if caching is supported by the persistence provider.protected PersistenceUnitTransactionType
Type of transactions used by EntityManagers from this persistence unit.protected PersistenceUnitValidationModeType
The validation mode to be used for the persistence unit. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetClazz()
Managed class to be included in the persistence unit and to scan for annotations.Description of this persistence unit.Jar file that is to be scanned for managed classes.The container-specific name of the JTA datasource to use.File containing mapping information.getName()
Name used in code to reference this persistence unit.The container-specific name of a non-JTA datasource to use.A list of standard and vendor-specific properties and hints.Provider class that supplies EntityManagers for this persistence unit.Defines whether caching is enabled for the persistence unit if caching is supported by the persistence provider.Type of transactions used by EntityManagers from this persistence unit.The validation mode to be used for the persistence unit.When set to true then only listed classes and jars will be scanned for persistent classes, otherwise the enclosing jar or directory will also be scanned.void
setDescription
(String value) Sets the value of the description property.void
setExcludeUnlistedClasses
(Boolean value) Sets the value of the excludeUnlistedClasses property.void
setJtaDataSource
(String value) Sets the value of the jtaDataSource property.void
Sets the value of the name property.void
setNonJtaDataSource
(String value) Sets the value of the nonJtaDataSource property.void
Sets the value of the properties property.void
setProvider
(String value) Sets the value of the provider property.void
Sets the value of the sharedCacheMode property.void
Sets the value of the transactionType property.void
Sets the value of the validationMode property.
-
Field Details
-
description
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") protected String descriptionDescription of this persistence unit. -
provider
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") protected String providerProvider class that supplies EntityManagers for this persistence unit. -
jtaDataSource
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") protected String jtaDataSourceThe container-specific name of the JTA datasource to use. -
nonJtaDataSource
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") protected String nonJtaDataSourceThe container-specific name of a non-JTA datasource to use. -
mappingFile
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") protected List<String> mappingFileFile containing mapping information. Loaded as a resource by the persistence provider. -
jarFile
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") protected List<String> jarFileJar file that is to be scanned for managed classes. -
clazz
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") protected List<String> clazzManaged class to be included in the persistence unit and to scan for annotations. It should be annotated with either @Entity, @Embeddable or @MappedSuperclass. -
excludeUnlistedClasses
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") protected Boolean excludeUnlistedClassesWhen set to true then only listed classes and jars will be scanned for persistent classes, otherwise the enclosing jar or directory will also be scanned. Not applicable to Java SE persistence units. -
validationMode
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") protected PersistenceUnitValidationModeType validationModeThe validation mode to be used for the persistence unit. -
properties
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") protected Persistence.PersistenceUnit.Properties propertiesA list of standard and vendor-specific properties and hints. -
name
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") protected String nameName used in code to reference this persistence unit. -
transactionType
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") protected PersistenceUnitTransactionType transactionTypeType of transactions used by EntityManagers from this persistence unit.
-
-
Constructor Details
-
PersistenceUnit
public PersistenceUnit()
-
-
Method Details
-
getDescription
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") public String getDescription()Description of this persistence unit.- Returns:
- possible object is
String
-
setDescription
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") public void setDescription(String value) Sets the value of the description property.- Parameters:
value
- allowed object isString
- See Also:
-
getProvider
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") public String getProvider()Provider class that supplies EntityManagers for this persistence unit.- Returns:
- possible object is
String
-
setProvider
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") public void setProvider(String value) Sets the value of the provider property.- Parameters:
value
- allowed object isString
- See Also:
-
getJtaDataSource
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") public String getJtaDataSource()The container-specific name of the JTA datasource to use.- Returns:
- possible object is
String
-
setJtaDataSource
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") public void setJtaDataSource(String value) Sets the value of the jtaDataSource property.- Parameters:
value
- allowed object isString
- See Also:
-
getNonJtaDataSource
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") public String getNonJtaDataSource()The container-specific name of a non-JTA datasource to use.- Returns:
- possible object is
String
-
setNonJtaDataSource
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") public void setNonJtaDataSource(String value) Sets the value of the nonJtaDataSource property.- Parameters:
value
- allowed object isString
- See Also:
-
getMappingFile
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") public List<String> getMappingFile()File containing mapping information. Loaded as a resource by the persistence provider. Gets the value of the mappingFile property.This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned list will be present inside the JAXB object. This is why there is not a
set
method for the mappingFile property.For example, to add a new item, do as follows:
getMappingFile().add(newItem);
Objects of the following type(s) are allowed in the list
String
- Returns:
- The value of the mappingFile property.
-
getJarFile
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") public List<String> getJarFile()Jar file that is to be scanned for managed classes. Gets the value of the jarFile property.This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned list will be present inside the JAXB object. This is why there is not a
set
method for the jarFile property.For example, to add a new item, do as follows:
getJarFile().add(newItem);
Objects of the following type(s) are allowed in the list
String
- Returns:
- The value of the jarFile property.
-
getClazz
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") public List<String> getClazz()Managed class to be included in the persistence unit and to scan for annotations. It should be annotated with either @Entity, @Embeddable or @MappedSuperclass. Gets the value of the clazz property.This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned list will be present inside the JAXB object. This is why there is not a
set
method for the clazz property.For example, to add a new item, do as follows:
getClazz().add(newItem);
Objects of the following type(s) are allowed in the list
String
- Returns:
- The value of the clazz property.
-
isExcludeUnlistedClasses
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") public Boolean isExcludeUnlistedClasses()When set to true then only listed classes and jars will be scanned for persistent classes, otherwise the enclosing jar or directory will also be scanned. Not applicable to Java SE persistence units.- Returns:
- possible object is
Boolean
-
setExcludeUnlistedClasses
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") public void setExcludeUnlistedClasses(Boolean value) Sets the value of the excludeUnlistedClasses property.- Parameters:
value
- allowed object isBoolean
- See Also:
-
getValidationMode
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") public PersistenceUnitValidationModeType getValidationMode()The validation mode to be used for the persistence unit.- Returns:
- possible object is
PersistenceUnitValidationModeType
-
setValidationMode
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") public void setValidationMode(PersistenceUnitValidationModeType value) Sets the value of the validationMode property.- Parameters:
value
- allowed object isPersistenceUnitValidationModeType
- See Also:
-
getProperties
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") public Persistence.PersistenceUnit.Properties getProperties()A list of standard and vendor-specific properties and hints.- Returns:
- possible object is
Persistence.PersistenceUnit.Properties
-
setProperties
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") public void setProperties(Persistence.PersistenceUnit.Properties value) Sets the value of the properties property.- Parameters:
value
- allowed object isPersistence.PersistenceUnit.Properties
- See Also:
-
getName
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") public String getName()Name used in code to reference this persistence unit.- Returns:
- possible object is
String
-
setName
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") public void setName(String value) Sets the value of the name property.- Parameters:
value
- allowed object isString
- See Also:
-
getTransactionType
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") public PersistenceUnitTransactionType getTransactionType()Type of transactions used by EntityManagers from this persistence unit.- Returns:
- possible object is
PersistenceUnitTransactionType
-
setTransactionType
@Generated(value="com.sun.tools.xjc.Driver", comments="JAXB RI v4.0.5", date="2025-08-14T20:27:42Z") public void setTransactionType(PersistenceUnitTransactionType value) Sets the value of the transactionType property.- Parameters:
value
- allowed object isPersistenceUnitTransactionType
- See Also:
-