OClass - addCluster()

This method adds a cluster to the database class.

Adding Clusters

When OrientDB saves records, it stores then clusters, using either physical or in-memory storage. With this method you can add a cluster to the class.


OClass OClass().addCluster(String name)
Argument Type Description
name String Defines the cluster name

Return Type

This method returns the updated OClass instance.


Consider the use case of a method that provisions a database for your application. You might run this as part of the installation process or to set up a new database for a particular process.

public ODatabaseDocument db;
private Logger logger;

// Provision Class with new Clusters
public void provisionClassClusters(OClass cls, List<String> clusters){

   // Log Operation
   logger.info("Adding clusters to class");

   // Iterator over List of Clusters
   for(String name : clusters){

         String.format("Creating Cluster '%s' on class '%s'",

This method takes an OClass instance and a List<String> instance, which contains a list of new cluster names.

results matching ""

    No results matching ""