Package de.xima.fc.plugin.entities
Class PluginPersistenceUnitInfo
- java.lang.Object
-
- de.xima.fc.plugin.entities.PluginPersistenceUnitInfo
-
- All Implemented Interfaces:
javax.persistence.spi.PersistenceUnitInfo
public class PluginPersistenceUnitInfo extends Object implements javax.persistence.spi.PersistenceUnitInfo
A simple implementation of aPersistenceUnitInfo
, intended for entities plugin. This is used to create an entity manager factory, which requires a persistence unit. Essentially, thePersistenceUnitInfo
can be thought of as the parsedpersistence.xml
file, so this lets us create a virtualpersistence.xml
in-memory.- Author:
- XIMA MEDIA GmbH
-
-
Constructor Summary
Constructors Constructor Description PluginPersistenceUnitInfo(ClassLoader classLoader, DataSource dataSource, String persistenceUnitName, Collection<Class<?>> managedClasses, Properties properties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTransformer(javax.persistence.spi.ClassTransformer transformer)
boolean
excludeUnlistedClasses()
ClassLoader
getClassLoader()
List<URL>
getJarFileUrls()
DataSource
getJtaDataSource()
List<String>
getManagedClassNames()
List<String>
getMappingFileNames()
ClassLoader
getNewTempClassLoader()
DataSource
getNonJtaDataSource()
String
getPersistenceProviderClassName()
String
getPersistenceUnitName()
URL
getPersistenceUnitRootUrl()
String
getPersistenceXMLSchemaVersion()
Properties
getProperties()
javax.persistence.SharedCacheMode
getSharedCacheMode()
javax.persistence.spi.PersistenceUnitTransactionType
getTransactionType()
javax.persistence.ValidationMode
getValidationMode()
-
-
-
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 namednon-jta-data-source
element in thepersistence.xml
file or provided at deployment or by the container.persistenceUnitName
- The name of the persistence unit. If you passnull
, a new name is generated.managedClasses
- A list of entity classes that will be available. Each name corresponds to a namedclass
element in thepersistence.xml
file.properties
- A map with additional properties that are passed to the JPA provider. Each property corresponds to a property element in thepersistence.xml
file or to a property set by the container.
-
-
Method Detail
-
getPersistenceUnitName
public String getPersistenceUnitName()
- Specified by:
getPersistenceUnitName
in interfacejavax.persistence.spi.PersistenceUnitInfo
-
getPersistenceProviderClassName
public String getPersistenceProviderClassName()
- Specified by:
getPersistenceProviderClassName
in interfacejavax.persistence.spi.PersistenceUnitInfo
-
getTransactionType
public javax.persistence.spi.PersistenceUnitTransactionType getTransactionType()
- Specified by:
getTransactionType
in interfacejavax.persistence.spi.PersistenceUnitInfo
-
getJtaDataSource
public DataSource getJtaDataSource()
- Specified by:
getJtaDataSource
in interfacejavax.persistence.spi.PersistenceUnitInfo
-
getNonJtaDataSource
public DataSource getNonJtaDataSource()
- Specified by:
getNonJtaDataSource
in interfacejavax.persistence.spi.PersistenceUnitInfo
-
getMappingFileNames
public List<String> getMappingFileNames()
- Specified by:
getMappingFileNames
in interfacejavax.persistence.spi.PersistenceUnitInfo
-
getJarFileUrls
public List<URL> getJarFileUrls()
- Specified by:
getJarFileUrls
in interfacejavax.persistence.spi.PersistenceUnitInfo
-
getPersistenceUnitRootUrl
public URL getPersistenceUnitRootUrl()
- Specified by:
getPersistenceUnitRootUrl
in interfacejavax.persistence.spi.PersistenceUnitInfo
-
getManagedClassNames
public List<String> getManagedClassNames()
- Specified by:
getManagedClassNames
in interfacejavax.persistence.spi.PersistenceUnitInfo
-
excludeUnlistedClasses
public boolean excludeUnlistedClasses()
- Specified by:
excludeUnlistedClasses
in interfacejavax.persistence.spi.PersistenceUnitInfo
-
getSharedCacheMode
public javax.persistence.SharedCacheMode getSharedCacheMode()
- Specified by:
getSharedCacheMode
in interfacejavax.persistence.spi.PersistenceUnitInfo
-
getValidationMode
public javax.persistence.ValidationMode getValidationMode()
- Specified by:
getValidationMode
in interfacejavax.persistence.spi.PersistenceUnitInfo
-
getProperties
public Properties getProperties()
- Specified by:
getProperties
in interfacejavax.persistence.spi.PersistenceUnitInfo
-
getPersistenceXMLSchemaVersion
public String getPersistenceXMLSchemaVersion()
- Specified by:
getPersistenceXMLSchemaVersion
in interfacejavax.persistence.spi.PersistenceUnitInfo
-
getClassLoader
public ClassLoader getClassLoader()
- Specified by:
getClassLoader
in interfacejavax.persistence.spi.PersistenceUnitInfo
-
addTransformer
public void addTransformer(javax.persistence.spi.ClassTransformer transformer)
- Specified by:
addTransformer
in interfacejavax.persistence.spi.PersistenceUnitInfo
-
getNewTempClassLoader
public ClassLoader getNewTempClassLoader()
- Specified by:
getNewTempClassLoader
in interfacejavax.persistence.spi.PersistenceUnitInfo
-
-