Class ConfiguringConnectionDecorator

  • All Implemented Interfaces:
    ConnectionDecorator

    public class ConfiguringConnectionDecorator
    extends java.lang.Object
    implements ConnectionDecorator
    Connection decorator that can configure some properties of the underlying connection. Understands the following properties:
    • QueryTimeout
    • TransactionIsolation(Connection constants)
    • AutoCommit
    Author:
    Abe White
    • Constructor Detail

      • ConfiguringConnectionDecorator

        public ConfiguringConnectionDecorator()
    • Method Detail

      • getQueryTimeout

        public int getQueryTimeout()
        The number of seconds to wait for a query to execute before terminating it.
      • setQueryTimeout

        public void setQueryTimeout​(int timeout)
        The number of seconds to wait for a query to execute before terminating it.
      • getTransactionIsolation

        public int getTransactionIsolation()
        The transaction isolation level.
      • setTransactionIsolation

        public void setTransactionIsolation​(int isolation)
        The transaction isolation level.
      • getAutoCommit

        public java.lang.Boolean getAutoCommit()
        Whether auto commit should be on. Use null to keep the connection's default setting. Defaults to null.
      • setAutoCommit

        public void setAutoCommit​(java.lang.Boolean autoCommit)
        Whether auto commit should be on. Use null to keep the connection's default setting. Defaults to null.
      • decorate

        public java.sql.Connection decorate​(java.sql.Connection conn)
                                     throws java.sql.SQLException
        Description copied from interface: ConnectionDecorator
        Decorate the given connection if desired.
        Specified by:
        decorate in interface ConnectionDecorator
        Throws:
        java.sql.SQLException