com.antelmann.sql
Class SQLFactoryDatabase
java.lang.Object
com.antelmann.db.AbstractDatabase<Connection>
com.antelmann.sql.SQLDatabase
com.antelmann.sql.SQLFactoryDatabase
- All Implemented Interfaces:
- Database<Connection>, LoginListener, LoggerProvider, QueryMechanism, Closeable, EventListener
- Direct Known Subclasses:
- GDB
public class SQLFactoryDatabase
- extends SQLDatabase
provides a specialized sql database which only opens the connection upon
transaction begin and then closes it on each commit/abort (and therefore uses a factory).
The embedded database service is a ConnectionWrapper that only provides
a connected connection during a transaction!
- Since:
- 10.09.2011, 02:54:04
- Author:
- Holger Antelmann
- See Also:
AbstractDatabase.getDatabaseService()
|
Constructor Summary |
SQLFactoryDatabase(Factory<Connection> factory)
calls this(factory, false), reconnect is enabled and the connection is only available within a transaction |
SQLFactoryDatabase(Factory<Connection> factory,
boolean usePermanentConnection)
Note that the connection opened by this instance remains open
(so that an inheriting class can still use that first connection that is instantiated). |
| Methods inherited from class com.antelmann.sql.SQLDatabase |
close, generateGenericClassStore, generateGenericClassStore, getColumnNames, getColumnTypes, getDisplayColumn, getHelper, getIDColumn, getRandomEntry, getTableName, getTableNames, getTableQuery, getTransaction, isValid, queryStoreForInterface |
| Methods inherited from class com.antelmann.db.AbstractDatabase |
addConfigListener, addStoreListener, checkAccessRight, checkTransactionActive, clearAllData, contains, contains, count, countStubs, delete, delete, delete, extractInterface, failedLogin, finalize, fireStoreChanges, getAccessController, getAvailableClassStores, getConfigListeners, getCurrentUser, getDatabaseService, getEntry, getEntry, getEntry, getFirstEntry, getFirstStub, getLogger, getOriginalClassStore, getRandomEntry, getRandomStub, getStore, getStoreForEntry, getStoreListeners, getStub, getStub, hasAutomatedTransactions, isEnsureTransactions, isVersioningEnabled, listEntries, listEntries, listStubs, loginPerformed, logoutPerformed, mapEntries, mapStubs, putClassStore, query, remove, removeConfigListener, removeStoreListener, setAccessController, setAutomatedTransactions, setCurrentUser, setEnsureTransactions, setVersioningEnabled, store |
SQLFactoryDatabase
public SQLFactoryDatabase(Factory<Connection> factory)
throws Exception
- calls this(factory, false), reconnect is enabled and the connection is only available within a transaction
- Throws:
Exception
SQLFactoryDatabase
public SQLFactoryDatabase(Factory<Connection> factory,
boolean usePermanentConnection)
throws Exception
- Note that the connection opened by this instance remains open
(so that an inheriting class can still use that first connection that is instantiated).
- Parameters:
usePermanentConnection - if true, it behaves pretty much like the super class
- Throws:
Exception
getFactory
public Factory<Connection> getFactory()
getDatabaseServiceAsWrapper
public ConnectionWrapper getDatabaseServiceAsWrapper()
isPermanentConnection
public boolean isPermanentConnection()
- See Also:
setPermanentConnection(boolean)
setPermanentConnection
public void setPermanentConnection(boolean disableAutoReconnect)
throws IllegalStateException,
SQLException
- if set to true, this instance behaves pretty much as if it were its superclass.
If false, the connection is only available during a transaction.
The method must be called outside a transaction.
- Throws:
IllegalStateException - if the method was called inside a transaction
SQLException - when either closing the connection or recreating the connection fails
createTransaction
protected SQLTransaction createTransaction()
throws SQLException
- Description copied from class:
SQLDatabase
- called by the constructor
- Overrides:
createTransaction in class SQLDatabase
- Throws:
SQLException
(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads