# Class DataNode

java.lang.Object
org.apache.cayenne.access.DataNode

public class DataNode extends Object
An abstraction of a single physical data storage. This is usually a database server, but can potentially be some other storage type like an LDAP server, etc.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected DbAdapter`
  `adapter`
  `protected Map<String,DataMap>`
  `dataMaps`
  `protected EntityResolver`
  `entityResolver`
  `protected EntitySorter`
  `entitySorter`
  `protected String`
  `name`
  `protected SchemaUpdateStrategy`
  `schemaUpdateStrategy`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DataNode()`
  Creates a new unnamed DataNode.
  `DataNode(String name)`
  Creates a new DataNode, assigning it a name.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addDataMap(DataMap map)`
  Adds a DataMap to be handled by this node.
  `DbAdapter`
  `getAdapter()`
  Returns DbAdapter object.
  `DataMap`
  `getDataMap(String name)`
  Returns datamap with specified name, null if none present
  `Collection<DataMap>`
  `getDataMaps()`
  Returns an unmodifiable collection of DataMaps handled by this DataNode.
  `DataSource`
  `getDataSource()`
  Returns DataSource used by this DataNode to obtain connections.
  `BatchTranslator<DeleteBatchQuery>`
  `getDeleteBatchTranslator()`
  `EJBQLTranslator`
  `getEjbqlTranslator()`
  `EntityResolver`
  `getEntityResolver()`
  Returns EntityResolver that handles DataMaps of this node.
  `EntitySorter`
  `getEntitySorter()`
  Returns an EntitySorter that sorts the entities of this node based on their mutual dependencies.
  `BatchTranslator<InsertBatchQuery>`
  `getInsertBatchTranslator()`
  `String`
  `getName()`
  Returns node name.
  `PkGenerator`
  `getPkGenerator()`
  Returns the PkGenerator used by this node to generate primary keys.
  `ProcedureTranslator`
  `getProcedureTranslator()`
  `RowReaderFactory`
  `getRowReaderFactory()`
  `SchemaUpdateStrategy`
  `getSchemaUpdateStrategy()`
  `SelectTranslator`
  `getSelectTranslator()`
  `SQLLogger`
  `getSqlLogger()`
  `SQLTemplateTranslator`
  `getSqlTemplateTranslator()`
  `BatchTranslator<UpdateBatchQuery>`
  `getUpdateBatchTranslator()`
  `DataNode`
  `lookupDataNode(DataMap dataMap)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  unused and unneeded
  `void`
  `performQueries(Collection<? extends Query> queries, OperationObserver callback)`
  Runs queries using Connection obtained from internal DataSource.
  `void`
  `removeDataMap(String mapName)`
  `void`
  `removeDataMap(DataMap map)`
  `void`
  `setAdapter(DbAdapter adapter)`
  `void`
  `setDataMaps(Collection<DataMap> dataMaps)`
  `void`
  `setDataSource(DataSource dataSource)`
  `void`
  `setDeleteBatchTranslator(BatchTranslator<DeleteBatchQuery> deleteBatchTranslator)`
  `void`
  `setEjbqlTranslator(EJBQLTranslator ejbqlTranslator)`
  `void`
  `setEntityResolver(EntityResolver entityResolver)`
  Sets EntityResolver.
  `void`
  `setEntitySorter(EntitySorter entitySorter)`
  Sets EntitySorter.
  `void`
  `setInsertBatchTranslator(BatchTranslator<InsertBatchQuery> insertBatchTranslator)`
  `void`
  `setName(String name)`
  `void`
  `setPkGenerator(PkGenerator pkGenerator)`
  Installs a custom PkGenerator, overriding the default generator of the node's `DbAdapter`.
  `void`
  `setProcedureTranslator(ProcedureTranslator procedureTranslator)`
  `void`
  `setRowReaderFactory(RowReaderFactory rowReaderFactory)`
  `void`
  `setSchemaUpdateStrategy(SchemaUpdateStrategy schemaUpdateStrategy)`
  `void`
  `setSelectTranslator(SelectTranslator selectTranslator)`
  `void`
  `setSQLLogger(SQLLogger logger)`
  `void`
  `setSqlTemplateTranslator(SQLTemplateTranslator sqlTemplateTranslator)`
  `void`
  `setUpdateBatchTranslator(BatchTranslator<UpdateBatchQuery> updateBatchTranslator)`
  `String`
  `toString()`

  ### Methods inherited from class Object

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

- ## Field Details

  - ### name

    protected String name

  - ### adapter

    protected DbAdapter adapter

  - ### entityResolver

    protected EntityResolver entityResolver

  - ### entitySorter

    protected EntitySorter entitySorter

  - ### schemaUpdateStrategy

    protected SchemaUpdateStrategy schemaUpdateStrategy

  - ### dataMaps

    protected Map<String,DataMap> dataMaps

- ## Constructor Details

  - ### DataNode

    public DataNode()
    Creates a new unnamed DataNode.

  - ### DataNode

    public DataNode(String name)
    Creates a new DataNode, assigning it a name.

- ## Method Details

  - ### getSchemaUpdateStrategy

    public SchemaUpdateStrategy getSchemaUpdateStrategy()
    Since:
      3.0

  - ### setSchemaUpdateStrategy

    public void setSchemaUpdateStrategy(SchemaUpdateStrategy schemaUpdateStrategy)
    Since:
      3.0

  - ### getSqlLogger

    public SQLLogger getSqlLogger()
    Since:
      3.1

  - ### setSQLLogger

    public void setSQLLogger(SQLLogger logger)
    Since:
      3.1

  - ### getName

    public String getName()
    Returns node name. Name is used to uniquely identify DataNode within a DataDomain.

  - ### setName

    public void setName(String name)

  - ### getDataMaps

    public Collection<DataMap> getDataMaps()
    Returns an unmodifiable collection of DataMaps handled by this DataNode.

  - ### getDataMap

    public DataMap getDataMap(String name)
    Returns datamap with specified name, null if none present

  - ### setDataMaps

    public void setDataMaps(Collection<DataMap> dataMaps)

  - ### addDataMap

    public void addDataMap(DataMap map)
    Adds a DataMap to be handled by this node.

  - ### removeDataMap

    public void removeDataMap(DataMap map)

  - ### removeDataMap

    public void removeDataMap(String mapName)

  - ### getDataSource

    public DataSource getDataSource()
    Returns DataSource used by this DataNode to obtain connections.

  - ### setDataSource

    public void setDataSource(DataSource dataSource)

  - ### getAdapter

    public DbAdapter getAdapter()
    Returns DbAdapter object. This is a plugin that handles RDBMS vendor-specific features.

  - ### setAdapter

    public void setAdapter(DbAdapter adapter)

  - ### getPkGenerator

    public PkGenerator getPkGenerator()
    Returns the PkGenerator used by this node to generate primary keys. Unless an explicit generator was installed with `setPkGenerator(PkGenerator)`, this is the default generator of the node's `DbAdapter`.
    Since:
      5.0

  - ### setPkGenerator

    public void setPkGenerator(PkGenerator pkGenerator)
    Installs a custom PkGenerator, overriding the default generator of the node's `DbAdapter`. A custom generator is retained across `setAdapter(DbAdapter)` calls. Passing null restores the adapter default.
    Since:
      5.0

  - ### lookupDataNode

    @Deprecated(since="5.0", forRemoval=true) public DataNode lookupDataNode(DataMap dataMap)
    Deprecated, for removal: This API element is subject to removal in a future version.
    unused and unneeded
    Returns a DataNode that should handle queries for all DataMap components.
    Since:
      1.1

  - ### performQueries

    public void performQueries(Collection<? extends Query> queries, OperationObserver callback)
    Runs queries using Connection obtained from internal DataSource.
    Since:
      1.1

  - ### getEntityResolver

    public EntityResolver getEntityResolver()
    Returns EntityResolver that handles DataMaps of this node.

  - ### setEntityResolver

    public void setEntityResolver(EntityResolver entityResolver)
    Sets EntityResolver. DataNode relies on externally set EntityResolver, so if the node is created outside of DataDomain stack, a valid EntityResolver must be provided explicitly.
    Since:
      1.1

  - ### getEntitySorter

    public EntitySorter getEntitySorter()
    Returns an EntitySorter that sorts the entities of this node based on their mutual dependencies.
    Since:
      5.0

  - ### setEntitySorter

    public void setEntitySorter(EntitySorter entitySorter)
    Sets EntitySorter. DataNode relies on an externally set sorter, so if the node is created outside of the DataDomain stack, a valid EntitySorter must be provided explicitly.
    Since:
      5.0

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### getRowReaderFactory

    public RowReaderFactory getRowReaderFactory()
    Since:
      4.0

  - ### setRowReaderFactory

    public void setRowReaderFactory(RowReaderFactory rowReaderFactory)
    Since:
      4.0

  - ### getInsertBatchTranslator

    public BatchTranslator<InsertBatchQuery> getInsertBatchTranslator()
    Since:
      5.0

  - ### setInsertBatchTranslator

    public void setInsertBatchTranslator(BatchTranslator<InsertBatchQuery> insertBatchTranslator)
    Since:
      5.0

  - ### getUpdateBatchTranslator

    public BatchTranslator<UpdateBatchQuery> getUpdateBatchTranslator()
    Since:
      5.0

  - ### setUpdateBatchTranslator

    public void setUpdateBatchTranslator(BatchTranslator<UpdateBatchQuery> updateBatchTranslator)
    Since:
      5.0

  - ### getDeleteBatchTranslator

    public BatchTranslator<DeleteBatchQuery> getDeleteBatchTranslator()
    Since:
      5.0

  - ### setDeleteBatchTranslator

    public void setDeleteBatchTranslator(BatchTranslator<DeleteBatchQuery> deleteBatchTranslator)
    Since:
      5.0

  - ### getSqlTemplateTranslator

    public SQLTemplateTranslator getSqlTemplateTranslator()
    Since:
      5.0

  - ### setSqlTemplateTranslator

    public void setSqlTemplateTranslator(SQLTemplateTranslator sqlTemplateTranslator)
    Since:
      5.0

  - ### getSelectTranslator

    public SelectTranslator getSelectTranslator()
    Since:
      5.0

  - ### setSelectTranslator

    public void setSelectTranslator(SelectTranslator selectTranslator)
    Since:
      5.0

  - ### getProcedureTranslator

    public ProcedureTranslator getProcedureTranslator()
    Since:
      5.0

  - ### setProcedureTranslator

    public void setProcedureTranslator(ProcedureTranslator procedureTranslator)
    Since:
      5.0

  - ### getEjbqlTranslator

    public EJBQLTranslator getEjbqlTranslator()
    Since:
      5.0

  - ### setEjbqlTranslator

    public void setEjbqlTranslator(EJBQLTranslator ejbqlTranslator)
    Since:
      5.0