public class JdbcDialectFactory extends Object implements DialectFactory
DialectFactory
for subclasses
of JdbcDialectImpl
.
Assumes that the dialect has a public constructor that takes a
Connection
as a parameter.
Constructor and Description |
---|
JdbcDialectFactory(Class<? extends JdbcDialectImpl> dialectClass,
Dialect.DatabaseProduct databaseProduct)
Creates a JdbcDialectFactory.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
acceptsConnection(Connection connection)
Returns whether this dialect is suitable for the given connection.
|
Dialect |
createDialect(DataSource dataSource,
Connection connection)
Creates a Dialect.
|
static Dialect |
createDialectHelper(DialectFactory factory,
DataSource dataSource)
Creates a temporary connection and calls
DialectFactory.createDialect(javax.sql.DataSource, java.sql.Connection) . |
public JdbcDialectFactory(Class<? extends JdbcDialectImpl> dialectClass, Dialect.DatabaseProduct databaseProduct)
dialectClass
- Dialect classdatabaseProduct
- Database type (e.g. Oracle) if this is a
common RDBMS, or null if it is an uncommon onepublic static Dialect createDialectHelper(DialectFactory factory, DataSource dataSource)
DialectFactory.createDialect(javax.sql.DataSource, java.sql.Connection)
.
Helper method, called when createDialect
is called without a
Connection
and the dialect factory
cannot create a dialect with DataSource
alone.
It is a user error if dataSource
is null (since this implies
that createDialect
was called with dataSource
and
connection
both null.
factory
- Dialect factorydataSource
- Data source, must not be nullpublic Dialect createDialect(DataSource dataSource, Connection connection)
DialectFactory
If the dialect cannot handle this connection, returns null.
createDialect
in interface DialectFactory
dataSource
- JDBC data sourceconnection
- JDBC connectionprotected boolean acceptsConnection(Connection connection)
connection
- ConnectionCopyright © 2019 Hitachi Vantara. All rights reserved.