public final class DatabaseContext extends Object
Modifier and Type | Field and Description |
---|---|
static String |
GENERIC_ENGINE
The name of the generic SQL engine, if no SQL engine specified.
|
Modifier | Constructor and Description |
---|---|
protected |
DatabaseContext(JdoConf jdoConf,
int index,
Mapping mapping,
ConnectionFactory factory)
Constructs a new AbstractConnectionFactory with given database and mapping.
|
protected |
DatabaseContext(String name,
String engine,
Mapping mapping,
TransactionManager txManager,
ConnectionFactory factory)
Constructs a new AbstractConnectionFactory with given name, engine and mapping.
|
Modifier and Type | Method and Description |
---|---|
ConnectionFactory |
getConnectionFactory() |
Database |
getDatabase()
Get the database configuration.
|
LockEngine |
getEngine()
Get the LockEngine only available after initialization.
|
Mapping |
getMapping()
Get the mapping to load.
|
String |
getName()
Get the name of the database configuration.
|
TransactionManager |
getTransactionManager()
Get the transaction manager.
|
void |
initialize()
Initialize factory if it had not been initialized before.
|
void |
initializeFactory() |
void |
setClassDescriptorResolver(JDOClassDescriptorResolver classDescriptorResolver)
Sets a custom
ClassDescriptorResolver instance. |
public static final String GENERIC_ENGINE
protected DatabaseContext(String name, String engine, Mapping mapping, TransactionManager txManager, ConnectionFactory factory) throws MappingException
name
- The Name of the database configuration.engine
- The Name of the persistence factory to use.txManager
- The transaction manager to use.mapping
- The previously loaded mapping.MappingException
- If LockEngine could not be initialized.protected DatabaseContext(JdoConf jdoConf, int index, Mapping mapping, ConnectionFactory factory)
jdoConf
- The JDO configuration.index
- Index of the database configuration in the JDO configuration.mapping
- The mapping to load.public void initialize() throws MappingException
MappingException
- If concrete factory or LockEngine fail to initialize
or mapping could not be loaded.public void initializeFactory() throws MappingException
MappingException
public ConnectionFactory getConnectionFactory()
public String getName()
public Database getDatabase()
public Mapping getMapping()
public TransactionManager getTransactionManager()
public LockEngine getEngine()
public void setClassDescriptorResolver(JDOClassDescriptorResolver classDescriptorResolver)
ClassDescriptorResolver
instance.classDescriptorResolver
- A custom ClassDescriptorResolver
instance to be used.Copyright © 2016. All rights reserved.