com.webobjects.jdbcadaptor
Class JDBCContext
java.lang.Object
|
+--com.webobjects.eoaccess.EOAdaptorContext
|
+--com.webobjects.jdbcadaptor.JDBCContext
- public class JDBCContext
- extends EOAdaptorContext
Method Summary |
void |
beginTransaction()
An abstract method that should be implemented by subclasses
to attempt to begin a new transaction. |
void |
commitTransaction()
An abstract method that should be implemented by subclasses
to attempt to commit the last transaction begun. |
boolean |
connect()
|
Connection |
connection()
|
EOAdaptorChannel |
createAdaptorChannel()
An abstract method that should be implemented by subclasses
to create and return a new EOAdaptorChannel, or null
if a new channel cannot be created. |
void |
disconnect()
|
void |
handleDroppedConnection()
An abstract method that should be implemented by subclasses to clean
up after the receiver's adaptor has lost its connection to its
database server. |
void |
rollbackTransaction()
An abstract method that should be implemented by subclasses
to attempt to roll back the last transaction begun. |
Methods inherited from class com.webobjects.eoaccess.EOAdaptorContext |
adaptor, canNestTransactions, channels, defaultDelegate, delegate, hasBusyChannels, hasOpenChannels, hasOpenTransaction, setDefaultDelegate, setDelegate, transactionDidBegin, transactionDidCommit, transactionDidRollback, transactionNestingLevel |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ANSI92ConformanceKey
public static final String ANSI92ConformanceKey
ANSIEntryConformance
public static final String ANSIEntryConformance
ANSIFullConformance
public static final String ANSIFullConformance
ANSIIntermediateConformance
public static final String ANSIIntermediateConformance
CreateParamsKey
public static final String CreateParamsKey
DBMSNameKey
public static final String DBMSNameKey
DefaultJDBCTypeKey
public static final String DefaultJDBCTypeKey
DriverNameKey
public static final String DriverNameKey
DriverVersionKey
public static final String DriverVersionKey
IdentifierQuoteStringKey
public static final String IdentifierQuoteStringKey
InternalTypeKey
public static final String InternalTypeKey
MaxScaleKey
public static final String MaxScaleKey
MinScaleKey
public static final String MinScaleKey
NonNullableColumnsKey
public static final String NonNullableColumnsKey
NullableKey
public static final String NullableKey
PrecisionKey
public static final String PrecisionKey
SearchableKey
public static final String SearchableKey
StringFunctionsKey
public static final String StringFunctionsKey
JDBCContext
public JDBCContext(EOAdaptor adaptor)
beginTransaction
public void beginTransaction()
- Description copied from class:
EOAdaptorContext
- An abstract method that should be implemented by subclasses
to attempt to begin a new transaction. A successful invocation of
beginTransaction
must be paired with an
invocation of either commitTransaction
or
rollbackTransaction
to end the transaction.
The Enterprise Objects Framework automatically wraps database
operations in transactions, so you don't have to begin and end
transactions explicitly. In fact, letting the framework manage
transactions is sometimes more efficient. You typically implement
beginTransaction
only to execute more than one database
operation in the same transaction scope.
This method should invoke the delegate method
adaptorContextShouldBegin
before beginning the
transaction. If the transaction is begun successfully, the method
should invoke transactionDidBegin
on the receiver and
invoke the delegate method adaptorContextDidBegin
.
Should throw a runtime exception if the attempt is unsuccessful.
Some possible reasons for failure are:
- A connection to the database hasn't been established.
- A transaction is already in progress.
- A fetch is in progress.
- The delegate refuses.
- The database server fails to begin a transaction.
- Overrides:
beginTransaction
in class EOAdaptorContext
- Following copied from class:
com.webobjects.eoaccess.EOAdaptorContext
- See Also:
EOAdaptorContext.hasOpenTransaction()
,
EOAdaptorContext.transactionDidBegin()
,
EOAdaptorContext.Delegate.adaptorContextShouldBegin(EOAdaptorContext adaptorContext)
,
EOAdaptorContext.Delegate.adaptorContextDidBegin(EOAdaptorContext adaptorContext)
commitTransaction
public void commitTransaction()
- Description copied from class:
EOAdaptorContext
- An abstract method that should be implemented by subclasses
to attempt to commit the last transaction begun. Should invoke
the delegate method
adaptorContextShouldCommit
before
committing the transaction. If the transaction is committed
successfully, the method should invoke
transactionDidCommit
and invoke the delegate
method adaptorContextDidCommit
. Should throw a runtime
exception if the attempt is unsuccessful. Some possible reasons for
failure are:
- A transaction is not in progress.
- Fetches are in progress.
- The delegate refuses.
- The database server fails to commit.
- Overrides:
commitTransaction
in class EOAdaptorContext
- Following copied from class:
com.webobjects.eoaccess.EOAdaptorContext
- See Also:
EOAdaptorContext.beginTransaction()
,
EOAdaptorContext.rollbackTransaction()
,
EOAdaptorContext.hasBusyChannels()
,
EOAdaptorContext.transactionDidCommit()
,
EOAdaptorContext.Delegate.adaptorContextShouldCommit(EOAdaptorContext adaptorContext)
,
EOAdaptorContext.Delegate.adaptorContextDidCommit(EOAdaptorContext adaptorContext)
connect
public boolean connect()
throws JDBCAdaptorException
connection
public Connection connection()
createAdaptorChannel
public EOAdaptorChannel createAdaptorChannel()
- Description copied from class:
EOAdaptorContext
- An abstract method that should be implemented by subclasses
to create and return a new EOAdaptorChannel, or
null
if a new channel cannot be created. Should set the new channel's
adaptorContext
to this
.
A newly created adaptor context has no channels. Specific
adaptors have different limits on the maximum number of channels a
context can have, and createAdaptorChannel
should fail
if a creating a new channel would exceed the limits.
- Overrides:
createAdaptorChannel
in class EOAdaptorContext
- Following copied from class:
com.webobjects.eoaccess.EOAdaptorContext
- Returns:
- A new EOAdaptorChannel.
- See Also:
EOAdaptorChannel.adaptorContext()
,
EOAdaptorContext.channels()
disconnect
public void disconnect()
throws JDBCAdaptorException
handleDroppedConnection
public void handleDroppedConnection()
- Description copied from class:
EOAdaptorContext
- An abstract method that should be implemented by subclasses to clean
up after the receiver's adaptor has lost its connection to its
database server. Invoked from EOAdaptor's
handleDroppedConnection
, this method should
clean up the state of the receiver and its adaptor channels so they
can be safely disposed of without any errors. Subclasses must
implement this method if the adaptor supports automatic database
reconnection.
Never invoke this method yourself; it is invoked automatically by
the Enterprise Objects Framework.
- Overrides:
handleDroppedConnection
in class EOAdaptorContext
- Following copied from class:
com.webobjects.eoaccess.EOAdaptorContext
- See Also:
EOAdaptor.handleDroppedConnection()
rollbackTransaction
public void rollbackTransaction()
- Description copied from class:
EOAdaptorContext
- An abstract method that should be implemented by subclasses
to attempt to roll back the last transaction begun. Should
invoke the delegate method
adaptorContextShouldRollback
before rolling back the transaction. If the transaction is begun
successfully, the method should invoke
transactionDidRollback
and invoke the delegate method
adaptorContextDidRollback
. Should throw a runtime
exception if the attempt is unsuccessful. Some possible reasons for
failure are:
- A transaction is not in progress.
- Fetches are in progress.
- The delegate refuses.
- The database server fails to rollback.
- Overrides:
rollbackTransaction
in class EOAdaptorContext
- Following copied from class:
com.webobjects.eoaccess.EOAdaptorContext
- See Also:
EOAdaptorContext.beginTransaction()
,
EOAdaptorContext.commitTransaction()
,
EOAdaptorContext.transactionDidRollback()
,
EOAdaptorContext.Delegate.adaptorContextShouldRollback(EOAdaptorContext adaptorContext)
,
EOAdaptorContext.Delegate.adaptorContextDidRollback(EOAdaptorContext adaptorContext)
Copyright © 2003 Apple Computer, Inc.