Class PluginPersistenceUnitInfo

  • All Implemented Interfaces:
    javax.persistence.spi.PersistenceUnitInfo

    public class PluginPersistenceUnitInfo
    extends Object
    implements javax.persistence.spi.PersistenceUnitInfo
    A simple implementation of a PersistenceUnitInfo, intended for entities plugin. This is used to create an entity manager factory, which requires a persistence unit. Essentially, the PersistenceUnitInfo can be thought of as the parsed persistence.xml file, so this lets us create a virtual persistence.xml in-memory.
    Author:
    XIMA MEDIA GmbH
    • Constructor Detail

      • PluginPersistenceUnitInfo

        public PluginPersistenceUnitInfo​(ClassLoader classLoader,
                                         DataSource dataSource,
                                         String persistenceUnitName,
                                         Collection<Class<?>> managedClasses,
                                         Properties properties)
        Parameters:
        classLoader - The class loader that is passed to the JPA provider for loading entity classes etc.
        dataSource - The (non-JTA) DataSource to be used to connect to the database. 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.
        persistenceUnitName - The name of the persistence unit. If you pass null, a new name is generated.
        managedClasses - A list of entity classes that will be available. Each name corresponds to a named class element in the persistence.xml file.
        properties - A map with additional properties that are passed to the JPA provider. Each property corresponds to a property element in the persistence.xml file or to a property set by the container.
    • Method Detail

      • getPersistenceUnitName

        public String getPersistenceUnitName()
        Specified by:
        getPersistenceUnitName in interface javax.persistence.spi.PersistenceUnitInfo
      • getPersistenceProviderClassName

        public String getPersistenceProviderClassName()
        Specified by:
        getPersistenceProviderClassName in interface javax.persistence.spi.PersistenceUnitInfo
      • getTransactionType

        public javax.persistence.spi.PersistenceUnitTransactionType getTransactionType()
        Specified by:
        getTransactionType in interface javax.persistence.spi.PersistenceUnitInfo
      • getJtaDataSource

        public DataSource getJtaDataSource()
        Specified by:
        getJtaDataSource in interface javax.persistence.spi.PersistenceUnitInfo
      • getNonJtaDataSource

        public DataSource getNonJtaDataSource()
        Specified by:
        getNonJtaDataSource in interface javax.persistence.spi.PersistenceUnitInfo
      • getMappingFileNames

        public List<String> getMappingFileNames()
        Specified by:
        getMappingFileNames in interface javax.persistence.spi.PersistenceUnitInfo
      • getJarFileUrls

        public List<URL> getJarFileUrls()
        Specified by:
        getJarFileUrls in interface javax.persistence.spi.PersistenceUnitInfo
      • getPersistenceUnitRootUrl

        public URL getPersistenceUnitRootUrl()
        Specified by:
        getPersistenceUnitRootUrl in interface javax.persistence.spi.PersistenceUnitInfo
      • getManagedClassNames

        public List<String> getManagedClassNames()
        Specified by:
        getManagedClassNames in interface javax.persistence.spi.PersistenceUnitInfo
      • excludeUnlistedClasses

        public boolean excludeUnlistedClasses()
        Specified by:
        excludeUnlistedClasses in interface javax.persistence.spi.PersistenceUnitInfo
      • getSharedCacheMode

        public javax.persistence.SharedCacheMode getSharedCacheMode()
        Specified by:
        getSharedCacheMode in interface javax.persistence.spi.PersistenceUnitInfo
      • getValidationMode

        public javax.persistence.ValidationMode getValidationMode()
        Specified by:
        getValidationMode in interface javax.persistence.spi.PersistenceUnitInfo
      • getProperties

        public Properties getProperties()
        Specified by:
        getProperties in interface javax.persistence.spi.PersistenceUnitInfo
      • getPersistenceXMLSchemaVersion

        public String getPersistenceXMLSchemaVersion()
        Specified by:
        getPersistenceXMLSchemaVersion in interface javax.persistence.spi.PersistenceUnitInfo
      • getClassLoader

        public ClassLoader getClassLoader()
        Specified by:
        getClassLoader in interface javax.persistence.spi.PersistenceUnitInfo
      • addTransformer

        public void addTransformer​(javax.persistence.spi.ClassTransformer transformer)
        Specified by:
        addTransformer in interface javax.persistence.spi.PersistenceUnitInfo
      • getNewTempClassLoader

        public ClassLoader getNewTempClassLoader()
        Specified by:
        getNewTempClassLoader in interface javax.persistence.spi.PersistenceUnitInfo