Package org.apache.openjpa.lib.jdbc
Class JDBCEvent
- java.lang.Object
-
- java.util.EventObject
-
- org.apache.openjpa.lib.jdbc.JDBCEvent
-
- All Implemented Interfaces:
java.io.Serializable
public class JDBCEvent extends java.util.EventObjectA JDBC event. The event source will be the connection.- Author:
- Marc Prud'hommeaux, Abe White
- See Also:
JDBCListener, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static shortAFTER_COMMITType code indicating that aConnectionwas just committed.static shortAFTER_CONNECTType code indicating that a connection was obtained.static shortAFTER_CREATE_STATEMENTType code indicating that aStatementis being created.static shortAFTER_EXECUTE_STATEMENTType code indicating that aStatementcompleted execution.static shortAFTER_PREPARE_STATEMENTType code indicating that aStatementis being prepared.static shortAFTER_ROLLBACKType code indicating that a rollback just occured.static shortBEFORE_CLOSEType code indicating that a connection was closed.static shortBEFORE_COMMITType code indicating that aConnectionis about to be committed.static shortBEFORE_CREATE_STATEMENTType code indicating that aStatementis being created.static shortBEFORE_EXECUTE_STATEMENTType code indicating that aStatementis about to be executed.static shortBEFORE_PREPARE_STATEMENTType code indicating that aStatementis being prepared.static shortBEFORE_ROLLBACKType code indicating that a rollback is about to occur.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JDBCEventgetAssociatedEvent()Return the associatedJDBCEventfor this event.java.sql.ConnectiongetConnection()Return the Connection for this event.java.lang.StringgetSQL()Return the SQL associated with this event; may be null.java.sql.StatementgetStatement()Return the Statement for this event, may be null for events unrelated to Statement execution.longgetTime()Return the time the event was constructed.shortgetType()Return the event's type code.
-
-
-
Field Detail
-
BEFORE_PREPARE_STATEMENT
public static final short BEFORE_PREPARE_STATEMENT
Type code indicating that aStatementis being prepared.- See Also:
- Constant Field Values
-
AFTER_PREPARE_STATEMENT
public static final short AFTER_PREPARE_STATEMENT
Type code indicating that aStatementis being prepared.- See Also:
- Constant Field Values
-
BEFORE_CREATE_STATEMENT
public static final short BEFORE_CREATE_STATEMENT
Type code indicating that aStatementis being created.- See Also:
- Constant Field Values
-
AFTER_CREATE_STATEMENT
public static final short AFTER_CREATE_STATEMENT
Type code indicating that aStatementis being created.- See Also:
- Constant Field Values
-
BEFORE_EXECUTE_STATEMENT
public static final short BEFORE_EXECUTE_STATEMENT
Type code indicating that aStatementis about to be executed.- See Also:
- Constant Field Values
-
AFTER_EXECUTE_STATEMENT
public static final short AFTER_EXECUTE_STATEMENT
Type code indicating that aStatementcompleted execution.- See Also:
- Constant Field Values
-
BEFORE_COMMIT
public static final short BEFORE_COMMIT
Type code indicating that aConnectionis about to be committed.- See Also:
- Constant Field Values
-
AFTER_COMMIT
public static final short AFTER_COMMIT
Type code indicating that aConnectionwas just committed.- See Also:
- Constant Field Values
-
BEFORE_ROLLBACK
public static final short BEFORE_ROLLBACK
Type code indicating that a rollback is about to occur.- See Also:
- Constant Field Values
-
AFTER_ROLLBACK
public static final short AFTER_ROLLBACK
Type code indicating that a rollback just occured.- See Also:
- Constant Field Values
-
AFTER_CONNECT
public static final short AFTER_CONNECT
Type code indicating that a connection was obtained. This does not necessarily mean that the connection is new if pooling is enabled.- See Also:
- Constant Field Values
-
BEFORE_CLOSE
public static final short BEFORE_CLOSE
Type 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:
- Constant Field Values
-
-
Constructor Detail
-
JDBCEvent
public JDBCEvent(java.sql.Connection source, short type, JDBCEvent associatedEvent, java.sql.Statement statement, java.lang.String sql)Constructor.
-
-
Method Detail
-
getType
public final short getType()
Return the event's type code.
-
getConnection
public final java.sql.Connection getConnection()
Return the Connection for this event.
-
getTime
public final long getTime()
Return the time the event was constructed.
-
getAssociatedEvent
public final JDBCEvent 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
public final java.lang.String getSQL()
Return the SQL associated with this event; may be null.
-
getStatement
public final java.sql.Statement getStatement()
Return the Statement for this event, may be null for events unrelated to Statement execution.
-
-