Interface BaseDAO<S extends SQL>
- All Known Implementing Classes:
FColorDao, FPlayerDAO, IgnoreDAO, MailDAO, ModerationDAO, SettingDAO, TimeDAO, VersionDAO
public interface BaseDAO<S extends SQL>
Base Data Access Object for database operations in FlectonePulse.
Provides common methods for transaction and handle management.
- Since:
- 0.9.0
-
Method Summary
Modifier and TypeMethodDescriptiondatabase()Gets the database instance associated with this DAO.default SgetSQL(org.jdbi.v3.core.Handle handle) Attaches the SQL interface to the given handle.default <R> RinTransaction(Function<S, R> action) Executes a function within a transaction and returns the result.sqlClass()Gets the SQL interface class for this DAO.default voiduseCustomTransaction(Consumer<org.jdbi.v3.core.Handle> action) Executes an action within a transaction.default voidExecutes an action using a database handle.default voiduseTransaction(Consumer<S> action) Executes an action within a transaction.default <R> RwithHandle(Function<S, R> action) Executes a function using a database handle and returns the result.
-
Method Details
-
database
Database database()Gets the database instance associated with this DAO.- Returns:
- the database instance
-
sqlClass
-
getSQL
Attaches the SQL interface to the given handle.- Parameters:
handle- the database handle- Returns:
- the attached SQL interface
-
useTransaction
-
useCustomTransaction
Executes an action within a transaction.- Parameters:
action- the action to execute with handle
-
inTransaction
-
useHandle
-
withHandle
-