Package org.jdbi.v3.spring5
Class JdbiUtil
- java.lang.Object
-
- org.jdbi.v3.spring5.JdbiUtil
-
public class JdbiUtil extends Object
Utility for working with Jdbi and Spring transaction bound resources
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcloseIfNeeded(Handle handle)Close a handle if it is not transactionally bound, otherwise no-opstatic HandlegetHandle(Jdbi jdbi)Obtain a Handle instance, either the transactionally bound one if we are in a transaction, or a new one otherwise.
-
-
-
Method Detail
-
getHandle
public static Handle getHandle(Jdbi jdbi)
Obtain a Handle instance, either the transactionally bound one if we are in a transaction, or a new one otherwise.- Parameters:
jdbi- the Jdbi instance from which to obtain the handle- Returns:
- the Handle instance
-
closeIfNeeded
public static void closeIfNeeded(Handle handle)
Close a handle if it is not transactionally bound, otherwise no-op- Parameters:
handle- the handle to consider closing
-
-