Package org.apache.openjpa.lib.jdbc
Class JDBCEvent
java.lang.Object
java.util.EventObject
org.apache.openjpa.lib.jdbc.JDBCEvent
- All Implemented Interfaces:
Serializable
A JDBC event. The event source will be the connection.
- Author:
- Marc Prud'hommeaux, Abe White
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final shortType code indicating that aConnectionwas just committed.static final shortType code indicating that a connection was obtained.static final shortType code indicating that aStatementis being created.static final shortType code indicating that aStatementcompleted execution.static final shortType code indicating that aStatementis being prepared.static final shortType code indicating that a rollback just occured.static final shortType code indicating that a connection was closed.static final shortType code indicating that aConnectionis about to be committed.static final shortType code indicating that aStatementis being created.static final shortType code indicating that aStatementis about to be executed.static final shortType code indicating that aStatementis being prepared.static final shortType code indicating that a rollback is about to occur.Fields inherited from class java.util.EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionJDBCEvent(Connection source, short type, JDBCEvent associatedEvent, Statement statement, String sql) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal JDBCEventReturn the associatedJDBCEventfor this event.final ConnectionReturn the Connection for this event.final StringgetSQL()Return the SQL associated with this event; may be null.final StatementReturn the Statement for this event, may be null for events unrelated to Statement execution.final longgetTime()Return the time the event was constructed.final shortgetType()Return the event's type code.Methods inherited from class java.util.EventObject
getSource, toString
-
Field Details
-
BEFORE_PREPARE_STATEMENT
public static final short BEFORE_PREPARE_STATEMENTType code indicating that aStatementis being prepared.- See Also:
-
AFTER_PREPARE_STATEMENT
public static final short AFTER_PREPARE_STATEMENTType code indicating that aStatementis being prepared.- See Also:
-
BEFORE_CREATE_STATEMENT
public static final short BEFORE_CREATE_STATEMENTType code indicating that aStatementis being created.- See Also:
-
AFTER_CREATE_STATEMENT
public static final short AFTER_CREATE_STATEMENTType code indicating that aStatementis being created.- See Also:
-
BEFORE_EXECUTE_STATEMENT
public static final short BEFORE_EXECUTE_STATEMENTType code indicating that aStatementis about to be executed.- See Also:
-
AFTER_EXECUTE_STATEMENT
public static final short AFTER_EXECUTE_STATEMENTType code indicating that aStatementcompleted execution.- See Also:
-
BEFORE_COMMIT
public static final short BEFORE_COMMITType code indicating that aConnectionis about to be committed.- See Also:
-
AFTER_COMMIT
public static final short AFTER_COMMITType code indicating that aConnectionwas just committed.- See Also:
-
BEFORE_ROLLBACK
public static final short BEFORE_ROLLBACKType code indicating that a rollback is about to occur.- See Also:
-
AFTER_ROLLBACK
public static final short AFTER_ROLLBACKType code indicating that a rollback just occured.- See Also:
-
AFTER_CONNECT
public static final short AFTER_CONNECTType code indicating that a connection was obtained. This does not necessarily mean that the connection is new if pooling is enabled.- See Also:
-
BEFORE_CLOSE
public static final short BEFORE_CLOSEType code indicating that a connection was closed. This does not necessarily mean that the underlying database connection was severed if pooling is enabled.- See Also:
-
-
Constructor Details
-
JDBCEvent
public JDBCEvent(Connection source, short type, JDBCEvent associatedEvent, Statement statement, String sql) Constructor.
-
-
Method Details
-
getType
public final short getType()Return the event's type code. -
getConnection
Return the Connection for this event. -
getTime
public final long getTime()Return the time the event was constructed. -
getAssociatedEvent
Return the associatedJDBCEventfor this event. For AFTER_XXX events, this will typically be the JDBCEvent that was created in the BEFORE_XXX stage. This may be null when an association is not appropriate for the event. -
getSQL
Return the SQL associated with this event; may be null. -
getStatement
Return the Statement for this event, may be null for events unrelated to Statement execution.
-