Package org.jdbi.v3.core
Interface ConnectionFactory
-
- All Known Implementing Classes:
SingleConnectionFactory
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ConnectionFactorySuppliesConnectioninstances to a createdHandleand allows custom close handling.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidcloseConnection(java.sql.Connection conn)Closes a connection.default CleanablegetCleanableFor(java.sql.Connection conn)Returns aCleanablethat will close the connection and release all necessary resources.java.sql.ConnectionopenConnection()Opens a connection.
-
-
-
Method Detail
-
openConnection
java.sql.Connection openConnection() throws java.sql.SQLExceptionOpens a connection.- Returns:
- A
Connectionobject. - Throws:
java.sql.SQLException- if anything goes wrong
-
closeConnection
default void closeConnection(java.sql.Connection conn) throws java.sql.SQLExceptionCloses a connection.- Parameters:
conn- AConnectionobject.- Throws:
java.sql.SQLException- if anything goes wrong
-
getCleanableFor
default Cleanable getCleanableFor(java.sql.Connection conn)
Returns aCleanablethat will close the connection and release all necessary resources.- Parameters:
conn- AConnectionobject.- Returns:
- A
Cleanableinstance. Calling theCleanable.close()method will close the connection and release all resources.
-
-