JNoSQL Book
  • Eclipse JNoSQL
  • LANGS
  • Eclipse JNoSQL one API to many NoSQL databases
    • About me
    • A principal ideia atrás da AP
    • Por que Diana?
    • Bibliografia
    • Credits
    • Introdução ao Diana
      • Value
      • Criando o seu próprio Writer and Reader
      • Element Entity
      • Document
      • Column
      • Entidade
      • ColumnFamilyEntity
      • DocumentEntity
      • KeyValueEntity
      • Manager
      • Column Manage
      • Document Manage
      • Bucket Manager
      • Factory
      • Column Family Manager Factory
      • Document Family Manager Factory
      • Bucket Manager Factory
      • Configuration
      • Document Configuration
      • Column Configuration
      • Key Value Configuration
    • Diversidade nos Bancos não relacionais
      • Utilizando drivers para com o Diana
    • Introdução ao Artemis
      • Anotações para o Modelo
      • Classes templates
      • Template de Documentos
      • Template de Família de Colunas
      • Template de Chave valor
      • CrudRepository
      • Lidando com os eventos da persistência
      • Bean Validation
    • Componentes do Artemis
      • Workflow
      • EventManager
      • Converter
      • As classes respositórios
    • SUMMARY
    • introduction
  • Eclipse JNoSQL one API para vários bancos NoSQL
    • introduction
    • The main idea behind the API
      • Why Diana?
    • Diana Introduction
      • Value
      • Make custom Writer and Reader
      • Element Entity
      • Document
      • Column
      • Entity
      • ColumnFamilyEntity
      • DocumentEntity
      • KeyValueEntity
      • Manager
      • Document Manager
      • Column Manager
      • Bucket Manager
      • Factory
      • [[Column Family Manager Factory](en/part2/chapter2_5_1.md)
      • Document Collection Factory
      • Bucket Manager Factory
      • Configuration
      • Document Configuration
      • Column Configuration
      • Key Value Configuration
    • The diversity on NoSQL databases
      • Using Diana drivers
      • Implementing a Document Driver
    • Artemis introduction
      • Models Annotation
      • Template classes
      • Document Template
      • Column Family Template
      • Key-value Template
      • Repository
      • Persistence events
      • Bean Validation
    • Artemis components
      • Workflow
      • EventManager
      • Converter
      • The repository class
    • SUMMARY
    • README
    • credits
    • About me
  • LICENSE
Powered by GitBook
On this page
  1. Eclipse JNoSQL one API para vários bancos NoSQL

The diversity on NoSQL databases

On NoSQL world beyond the several types, it's trivial a particular database has features that do exist on this provider.

When there is a change among the types, column family, and document collection, there is a considerable change. Notably, with there a switch to the same kind such as column family to column family, e.g., Cassandra to HBase, there is the same problem once Cassandra has featured such as Cassandra query language and consistency level.

The Diana allows looking the variety on NoSQL database. The configurations classes, and entity factory return specialist class from a provider.

public interface ColumnFamilyManagerFactory<SYNC extends ColumnFamilyManager> extends AutoCloseable {
SYNC get(String database);
}

A ColumnFamilyManagerFactory return a class the implements ColumnFamilyManager.

E.g: Using a particular resource from Cassandra driver.

CassandraConfiguration condition = new CassandraConfiguration();
try(CassandraDocumentEntityManagerFactory managerFactory = condition.get()) {
    CassandraColumnFamilyManager columnEntityManager = managerFactory.get(KEY_SPACE);
    ColumnEntity entity = ColumnEntity.of(COLUMN_FAMILY);
    Column id = Column.of("id", 10L);
    entity.add(id);
    entity.add(Column.of("version", 0.001));
    entity.add(Column.of("name", "Diana"));
    entity.add(Column.of("options", Arrays.asList(1, 2, 3)));
    columnEntityManager.save(entity);
    //common implementation
    ColumnQuery query = ColumnQuery.of(COLUMN_FAMILY);
    query.and(ColumnCondition.eq(id));
    Optional<ColumnEntity> result = columnEntityManager.singleResult(query);
    //cassandra implementation
    columnEntityManager.save(entity, ConsistencyLevel.THREE);
    List<ColumnEntity> entities = columnEntityManager.cql("select * from newKeySpace.newColumnFamily");
    System.out.println(entities);
}
PreviousKey Value ConfigurationNextUsing Diana drivers

Last updated 7 years ago