Key Value
● AmazonDynamo● AmazonS3● Redis● Scalaris● Voldemort ● Couchbase● Hazelcast
valuekey
valuekey
valuekey
Column Family
● Hbase● Cassandra● Scylla● Clouddata● SimpleDb● DynamoDB
Row-key Columns...
Apollo
Aphrodite
Ares
SunDuty
{Love, happy}Duty
WarDuty
Swordweapon
Color
KratosDead Gods
13
Graph
● Neo4j● InfoGrid● Sones● HyperGraphDB
Apollo Ares
Kratoswas killed by was killed by
Is brother
killed killed
Multi-Model● OrientDB (graph, document)
● Couchbase (key value, document)
● Elasticsearch (document, graph)
● Cassandra (column family, graph - in progress)
SQL Key-value Document Column Graph
Table Bucket Collection Column Family
Vertex and Edge
Row Key/value pair
Document Column Vertex
Column Key/value pair
Key/value pair
Vertex and Edge property
Relationship Link Edge
Relational Application
DAO
API API API
Data Tier
Logic Tier
DAO
Logic Tier
Data Tier
JPA
JDBC
JPA
JDBC
JPA
JDBC
NoSQL Application
JPA problem for NoSQL
● Saves Async● Async Callback● Time to Live (TTL)● Consistency Level● SQL based● Diversity in NoSQL
JNoSQL
● Mapping API● Communication API● No lock-in● Divide and conquer
DAO
Mapping
Communication
DocumentKey
Column Graph
DIANA
ARTEMIS
JNoSQL
Data Tier
JNoSQL
● Eclipse Foundation● Apache + Eclipse License● API to each NoSQL type● Configurable● Extensible
Mapping
Communication DIANA
ARTEMIS
Why Diana?
● Goddess of the hunt, nature and moon
● Fought in Troy● Brave warrior and hunter● Diana Rome = Artemis Greek
Communication Issue
ODocument document = new ODocument(“collection”);document.field(name, value);
JsonObject jsonObject = JsonObject.create();jsonObject.put(name, value);
BaseDocument baseDocument = new BaseDocument();baseDocument.addAttribute(name, value);
Document document = new Document();document.append(name, value);
Communication Issue
ODocument document = new ODocument(“collection”);document.field(name, value);
JsonObject jsonObject = JsonObject.create();jsonObject.put(name, value);
BaseDocument baseDocument = new BaseDocument();baseDocument.addAttribute(name, value);
Document document = new Document();document.append(name, value);
Communication Issue
DocumentEntity entity = DocumentEntity.of("documentCollection");Document document = Document.of(name, value);entity.add(document);
Issues
● insert vs save● delete vs remove● update vs merge● find vs. search● callback interface to
asynchronous callback
● long to seconds● int to seconds● long to milliseconds● int to milliseconds
Diana Project
● Document API● Graph API● Key-value API● Column API● Four TCKs
Database
API
Implementation
TCK
DiversityColumnEntity 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)));
//mutiple implementationcolumnEntityManager.save(entity);ColumnQuery query = ColumnQuery.of(COLUMN_FAMILY);query.addCondition(ColumnCondition.eq(id));Optional<ColumnEntity> result = columnEntityManager.singleResult(query);
//cassandra onlyList<ColumnEntity> entities = columnEntityManagerCassandra.cql("select * from newKeySpace.newColumnFamily where id=10;");columnEntityManagerCassandra.save(entity, ConsistencyLevel.ALL);
Artemis● CDI Based● Diana Based● Annotation Based● Events to insert, delete, update● Supports to Bean Validation● Configurable and Extensible● Query Method
Annotations
● MappedSuperclass● Entity● Column
@Entity("movie")public class Movie {
@Column private String name;
@Column private long year;
@Column private Set<String> actors;
interface PersonRepository extends Repository<Person> {
Person findByName(String name);
void deleteByName(String name);
Optional<Person> findByAge(Integer age);
List<Person> findByNameAndAge(String name, Integer age);
Set<Person> findByAgeAndName(Integer age, String name);
Stream<Person> findByNameAndAgeOrderByName(String name, Integer age);
Queue<Person> findByNameAndAgeOrderByAge(String name, Integer age);}
Dynamic Query
Configurable and extensible● EventManager● CrudOperation● ClassRepresentations● Converter● Decorate● Replace
@Entity("person")public class Person {
@Columnprivate String name;
@Columnprivate Integer age;
@UDT("address")@Columnprivate Address home;
}
interface PersonRepository extends CassandraRepository<Person> {
Person findByName(String name, ConsistencyLevel level);
void deleteByName(String name, ConsistencyLevel level);
@CQL("select * from Person") List<Person> findAll();
@CQL("select * from Person where name = ?") List<Person> findByName(String name);}
Road Map
✓ Draft and code proposal
✓ Community Feedback
✓ Involve NoSQL Vendors
✓ Involve Solution Vendors
✓ Eclipse Project
✓ Development
✓ JSR
Thank you
Otávio Santana@[email protected]@apache.org
Top Related