OrientDB Manual 1.7.8

Java API

OrientDB is written 100% in Java. You can use the native Java APIs without any driver or adapter.

Architecture of components

image

OrientDB provides 3 different Java APIs to work with OrientDB. Each one has pros and cons.

APIs

Graph API

Use OrientDB as a Graph Database working with Vertices and Edges. Graph API is 100% compliant with TinkerPop standard.

API: Graph API

Document API

Handles records as documents. Documents are comprised of fields. Fields can be any of the types supported. Does not need a Java domain POJO, as required for the Object Database. Can be used as schema-less or schema-base modes.

API: Document API

Object API

It's the JPA like interface where POJO are automatically bound to the database as documents. Can be used in schema-less or schema-based modes.

API: Object Database

What to use? Feature Matrix

Graph Document Object
API Graph API Document API Object Database
Use this if You work with graphs and want your code to be portable across TinkerPop Blueprints implementations Your domain fits better the Document Database use case with schema-less structures If you need a full Object Oriented abstraction that binds all the database entities to POJO (Plain Old Java Object)
Easy to switch from Other GraphDBs like Neo4J or Titan. If you used TinkerPop standard OrientDB is a drop-in replacement Other DocumentDB like MongoDB and CouchDB JPA applications
Java class OrientGraph ODatabaseDocumentTx OObjectDatabaseTx
Query Yes Yes Yes
Schema Less Yes Yes Yes
Schema full Yes Yes Yes
Speed* 90% 100% 50%

* Speed comparison for generic CRUD operations such as query, insertion, update and deletion. Larger is better. 100% is fastest. In general the price of a high level of abstraction is a speed penalty, but remember that Orient is orders of magnitude faster than the classic RDBMS. So using the Object Database gives you a high level of abstraction with much less code to develop and maintain.

Which library do I use?

OrientDB comes with some jar files contained in the lib directory

JAR nameDescription When required? Depends on 3rd party jars
orient-commons-.jarLibrary with some utility classes that are not part of OrientDB itself but usable with any kind of projectAlways
orientdb-core-.jarCore libraryAlwayssnappy-.jar,
Optional Performance Pack: orientdb-nativeos-
.jar,jna-.jar and jna-platform-.jar
orientdb-client-.jarRemote clientWhen your application talks with a remote server
orientdb-enterprise-.jarBase package with the protocol and network classes shared by client and serverWhen your application talks with a remote server
orientdb-server-.jarServer componentIt's used by the server component. Include it only if you're embedding a server
orientdb-tools-.jarContain the console and console commandsNever, unless you want to execute console command directly by your application. Used by the console application
orientdb-object-.jarContain the Object Database interfaceInclude it if you're using this interfacejavassist.jar, persistence-api-1.0.jar
orientdb-graphdb-.jarContain the GraphDB interfaceInclude it if you're using this interfaceblueprints-core-.jar, blueprints-orient-graph-.jar
orientdb-distributed-.jarContain the distributed pluginInclude it if you're working with a server clusterhazelcast-.jar