- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
DbClientBase
,MongoDbClient
Helidon database client.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final class
Helidon database handler builder. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Qualifier used for mapping usingMapperManager.map(Object, Class, Class, String...)
. -
Method Summary
Modifier and TypeMethodDescriptionstatic DbClient.Builder
builder()
Create Helidon database client builder.static DbClient.Builder
Create Helidon database client builder from configuration.static DbClient.Builder
builder
(DbClientProvider provider) Create Helidon database client builder using specific SPI provider.static DbClient.Builder
Create Helidon database client builder.void
close()
Closes the DbClient and releases any associated resources.static DbClient
Create Helidon database client.dbType()
Type of this database provider (such as jdbc:mysql, mongoDB etc.).execute()
Execute database statements.Execute database statements in transaction.<C> C
Unwrap database client internals.
-
Field Details
-
MAPPING_QUALIFIER
Qualifier used for mapping usingMapperManager.map(Object, Class, Class, String...)
.- See Also:
-
-
Method Details
-
dbType
String dbType()Type of this database provider (such as jdbc:mysql, mongoDB etc.).- Returns:
- name of the database provider
-
execute
DbExecute execute()Execute database statements.- Returns:
- database statements executor
-
transaction
DbTransaction transaction()Execute database statements in transaction.DbTransaction
life-cycle must always be finished withDbTransaction.commit()
orDbTransaction.rollback()
. Those two methods mentioned above will also release database resources allocated by this transaction.- Returns:
- transaction to execute database statements
-
unwrap
Unwrap database client internals. Only database connection is supported.When
java.sql.Connection
is requested for JDBC provider, this connection must be closed by user code usingclose()
method on returnedConnection
instance.- Type Parameters:
C
- target class to be unwrapped- Parameters:
cls
- target class to be unwrapped- Returns:
- database client internals matching provided class.
- Throws:
UnsupportedOperationException
- when provided class is not supported
-
close
void close()Closes the DbClient and releases any associated resources.- Specified by:
close
in interfaceAutoCloseable
-
create
Create Helidon database client.- Parameters:
config
- name of the configuration node with driver configuration- Returns:
- database client instance
-
builder
Create Helidon database client builder.Database driver is loaded as SPI provider which implements the
DbClientProvider
interface. First provider on the class path is selected.- Returns:
- database client builder
-
builder
Create Helidon database client builder using specific SPI provider.- Parameters:
provider
- SPI provider to use- Returns:
- database client builder
-
builder
Create Helidon database client builder.Database driver is loaded as SPI provider which implements the
DbClientProvider
interface. Provider matchingproviderName
on the class path is selected.- Parameters:
providerName
- SPI provider name- Returns:
- database handler builder
- Throws:
DbClientException
- whenproviderName
was not found
-
builder
Create Helidon database client builder from configuration.- Parameters:
dbConfig
- configuration that should contain the keysource
that defines the type of this database and is used to load appropriateDbClientProvider
from Java Service loader- Returns:
- a builder pre-configured from the provided config
-