Class PersistenceUnitMetaData

  • All Implemented Interfaces:
    java.io.Serializable

    public class PersistenceUnitMetaData
    extends MetaData
    MetaData representation of a "persistence.xml" persistence unit. Corresponds to the JPA spec section 6.2.1
    See Also:
    Serialized Form
    • Field Detail

      • name

        java.lang.String name
        Name of the persistence unit.
      • rootURI

        java.net.URI rootURI
        Root of the persistence unit. This can be used if wanting to scan for classes, to find the root to scan from.
      • transactionType

        TransactionType transactionType
        Transaction type for this persistence unit.
      • description

        java.lang.String description
        Description of the persistence unit.
      • provider

        java.lang.String provider
        Provider for the persistence unit.
      • validationMode

        java.lang.String validationMode
        Validation Mode for Bean Validator.
      • jtaDataSource

        java.lang.String jtaDataSource
        JTA data source for the persistence unit.
      • nonJtaDataSource

        java.lang.String nonJtaDataSource
        Non-JTA data source for the persistence unit.
      • classNames

        java.util.Set<java.lang.String> classNames
        Names of the classes specified.
      • jarFiles

        java.util.Set<java.lang.Object> jarFiles
        Names/URLs of the JAR files specified.
      • mappingFileNames

        java.util.Set<java.lang.String> mappingFileNames
        Names of the mapping files specified.
      • properties

        java.util.Properties properties
        Vendor properties.
      • excludeUnlistedClasses

        boolean excludeUnlistedClasses
        Whether to exclude unlisted classes.
      • sharedCacheMode

        java.lang.String sharedCacheMode
        L2 cache mode for persistable objects.
    • Constructor Detail

      • PersistenceUnitMetaData

        public PersistenceUnitMetaData​(java.lang.String name,
                                       java.lang.String transactionType,
                                       java.net.URI rootURI)
        Constructor.
        Parameters:
        name - Name of the persistence unit
        transactionType - Transaction type for this unit
        rootURI - Root of the persistence-unit
    • Method Detail

      • getName

        public java.lang.String getName()
      • getRootURI

        public java.net.URI getRootURI()
        Accessor for the persistence unit root.
        Returns:
        Root of the persistence unit
      • setTransactionType

        public void setTransactionType​(java.lang.String transType)
      • getSharedCacheMode

        public java.lang.String getSharedCacheMode()
        Accessor for the persistence unit shared cache mode.
        Returns:
        Caching policy: ALL, NONE, ENABLE_SELECTIVE, DISABLE_SELECTIVE, UNSPECIFIED.
      • setSharedCacheMode

        public void setSharedCacheMode​(java.lang.String cache)
        Mutator for the shared cache mode.
        Parameters:
        cache - The shared cache mode: ALL, NONE, ENABLE_SELECTIVE, DISABLE_SELECTIVE, UNSPECIFIED.
      • getDescription

        public java.lang.String getDescription()
      • setDescription

        public void setDescription​(java.lang.String desc)
      • getProvider

        public java.lang.String getProvider()
      • setProvider

        public void setProvider​(java.lang.String provider)
      • getJtaDataSource

        public java.lang.String getJtaDataSource()
      • setJtaDataSource

        public void setJtaDataSource​(java.lang.String data)
      • getNonJtaDataSource

        public java.lang.String getNonJtaDataSource()
      • setNonJtaDataSource

        public void setNonJtaDataSource​(java.lang.String data)
      • setValidationMode

        public void setValidationMode​(java.lang.String validationMode)
        Mutator for the validation mode
        Parameters:
        validationMode - AUTO, CALLBACK or NONE
      • getValidationMode

        public java.lang.String getValidationMode()
        Accessor to the Validation Mode
        Returns:
        AUTO, CALLBACK or NONE
      • setExcludeUnlistedClasses

        public void setExcludeUnlistedClasses​(boolean flag)
      • getExcludeUnlistedClasses

        public boolean getExcludeUnlistedClasses()
      • addClassName

        public void addClassName​(java.lang.String className)
      • addClassNames

        public void addClassNames​(java.util.Set<java.lang.String> classNames)
      • addJarFile

        public void addJarFile​(java.lang.String jarName)
      • addJarFiles

        public void addJarFiles​(java.util.Set<java.lang.String> jarNames)
      • addJarFile

        public void addJarFile​(java.net.URL jarURL)
        Method to add a jar file to the persistence unit.
        Parameters:
        jarURL - Jar file URL
      • clearJarFiles

        public void clearJarFiles()
        Convenience method to clear out all jar files.
      • addMappingFile

        public void addMappingFile​(java.lang.String mappingFile)
      • addProperty

        public void addProperty​(java.lang.String key,
                                java.lang.String value)
      • getClassNames

        public java.util.Set<java.lang.String> getClassNames()
      • getMappingFiles

        public java.util.Set<java.lang.String> getMappingFiles()
      • getJarFiles

        public java.util.Set getJarFiles()
        Accessor for the jar files for this persistence unit. The contents of the Set may be Strings (the names) or URLs
        Returns:
        The jar names
      • getProperties

        public java.util.Properties getProperties()
      • toString

        public java.lang.String toString​(java.lang.String prefix,
                                         java.lang.String indent)
        Returns a string representation of the object using a prefix This can be used as part of a facility to output a MetaData file.
        Parameters:
        prefix - prefix string
        indent - indent string
        Returns:
        a string representation of the object.