DefaultDbAdapterFactory (cayenne-doc: Cayenne Documentation 5.0-M2 API)
Description: declaration: package: org.apache.cayenne.configuration.runtime, class: DefaultDbAdapterFactory

# Class DefaultDbAdapterFactory

java.lang.Object
org.apache.cayenne.configuration.runtime.DefaultDbAdapterFactory

All Implemented Interfaces:
  `DbAdapterFactory`

public class DefaultDbAdapterFactory extends Object implements DbAdapterFactory
A factory of DbAdapters that either loads user-provided adapter or guesses the adapter type from the database metadata.

Since:
  3.1

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected List<DbAdapterDetector>`
  `detectors`
  `protected Injector`
  `injector`
  `protected JdbcEventLogger`
  `jdbcEventLogger`
  `protected AdhocObjectFactory`
  `objectFactory`
  `protected PkGeneratorFactoryProvider`
  `pkGeneratorProvider`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultDbAdapterFactory(List<DbAdapterDetector> detectors)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `DbAdapter`
  `createAdapter(DataNodeDescriptor nodeDescriptor, DataSource dataSource)`
  Returns an instance of DbAdapter if the factory detects that it knows how to handle the database.
  `protected DbAdapter`
  `defaultAdapter()`
  `protected DbAdapter`
  `detectAdapter(DatabaseMetaData metaData)`
  `protected DbAdapter`
  `detectAdapter(DataSource dataSource)`
  `protected DbAdapter`
  `setupPkGenerator(DbAdapter dbAdapter)`
  Setup PK generator for the adapter

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### injector

    protected Injector injector

  - ### jdbcEventLogger

    protected JdbcEventLogger jdbcEventLogger

  - ### objectFactory

    protected AdhocObjectFactory objectFactory

  - ### pkGeneratorProvider

    protected PkGeneratorFactoryProvider pkGeneratorProvider

  - ### detectors

    protected List<DbAdapterDetector> detectors

- ## Constructor Details

  - ### DefaultDbAdapterFactory

    public DefaultDbAdapterFactory(List<DbAdapterDetector> detectors)

- ## Method Details

  - ### createAdapter

    public DbAdapter createAdapter(DataNodeDescriptor nodeDescriptor, DataSource dataSource)
    Description copied from interface: `DbAdapterFactory`
    Returns an instance of DbAdapter if the factory detects that it knows how to handle the database.
    Specified by:
      `createAdapter` in interface `DbAdapterFactory`

  - ### detectAdapter

    protected DbAdapter detectAdapter(DataSource dataSource)

  - ### detectAdapter

    protected DbAdapter detectAdapter(DatabaseMetaData metaData) throws SQLException
    Throws:
      `SQLException`

  - ### defaultAdapter

    protected DbAdapter defaultAdapter()

  - ### setupPkGenerator

    protected DbAdapter setupPkGenerator(DbAdapter dbAdapter)
    Setup PK generator for the adapter
    Parameters:
      `dbAdapter` - to process
    Returns:
      db adapter
    Since:
      4.1