CON11031_Greene-JavaOneSF2013_CON11031_v1.1

computerharpySoftware and s/w Development

Dec 2, 2013 (3 years and 11 months ago)

69 views

Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

1

Building Oracle NoSQL
Database Applications with
EclipseLink

Robert Greene: Oracle NoSQL Database

John Bracken, Shaun Smith: EclipseLink

Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

3

The following is intended to outline our general product direction.
It
is intended

for
information purposes only, and may not be incorporated into any contract.

It
is not a commitment to deliver any material, code,
or
functionality, and should
not be relied upon in making purchasing decisions. The development, release,
and timing of any features or functionality described for Oracle

s products
remains at the sole discretion of Oracle.



Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

4

Program Agenda


Oracle NoSQL Database


Architecture, value proposition, key features


EclipseLink for
NoSQL


JPA
-
style API for
NoSQL

Databases


RESTful

services for JPA


Deep Dive

EclipseLink
NoSQL

for ONDB

Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

5

Traditional
Business

New Data,
React Faster



Smart & Agile
Business



NoSQL

Modern Data

(social data,

public data,

streaming data
machine data)

Where did it come from and What is it?

Big Data

Better Program
Management,
Just in Time
Manufacturing,

Social
Mktng

Basic Data
(accounts,
contacts,
inventory,
employees)

Technology

Competition

New Data
Use requiring
New Data
Management

NoSQL

Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

6

Logical Architecture


Applications View


Elastic partitions
(split, add, contract
)

Store

Partition

D

Partition

D

R

Partition

D

R

R

Application

NoSQL Driver

R

R

R


Writes

to elected
node



Reads

from any
node in system

Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

7

Physical Architecture


Application

NoSQL Driver

Data Center

Zone 1

D

Net Switches

Servers

Disks

Racks

R

R

Data Center

Zone 2

D

R

R

Data Center

Zone 3

D

R

R

R

D


Intelligent latency
selective

reads from
any node


Elected
Master

for
TXN ops


Isolated
replicas for
always
-
on

availability

Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

8


Flexible Key
-
Value Data Model


ACID transactions


Horizontally Scalable


Highly Available


Elastic Configuration


Simple administration


Intelligent Driver


Commercial grade software and
support

Features

Oracle NoSQL Database

Application

Storage Nodes

Datacenter B

Storage Nodes

Datacenter A

Application

NoSQL DB Driver

Application

NoSQL DB Driver

Application

Java SE 6 (JDK 1.6.0 u25)+; Solaris or Linux


Scalable, Highly Available, Key
-
Value Database

Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

9

Oracle
NoSQL

Database

Fully integrated for the Enterprise

Real Time Access

External Tables

MapReduce,
OLH, ODC, ODI

NoSQL DB Driver

Application

GRAPH

Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

10

Developing Applications


Major
-
Minor ( hash


local )


Keep small ( memory ), align with queries

Data Modeling

userid

address

subscriptions

email id

phone #

expiration date

Major key:

Minor key
:

Value:

Strings

Byte Array


Value Options:

Binary

JSON

RDF Triples

Tables/Rows

picture

.jpg

Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

11

Developing Applications

Data Modeling

Subject

ID

Qualifier






Value Type


Range

Binary

AVRO

RDF Triples

Tables/Rows


Range

Queries

sensors by section



Pressure Sensor

Sensor ID

Left Front

What

a List

The Value

Value Types

PS

123
-
PS3234

LF






psi, irate


Timestamp


Array of
Int

=

=

A specific sensor



All measures of a sensor


A range of sensor measures


UUID

Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

12

JSON Data Format


Why Avro?


Compact, highly efficient serialization


Synergy with Hadoop


Schema


DDL allows schema creation through Avro JSON definition


Supports serialization from/to JSON strings


Schema evolution


Easy to use mechanism for schema evolution


Schema versions can be opaque to readers

Avro Based Serialization/
DeSerialization

of the Value

Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

13

Developing Applications


Feature Advantages Delivered


Seamless development paradigm between Relational and NoSQL


Annotation based persistence configuration


Transparent management of inter value references ( 1 to 1 )


Transparent management of intra value references ( Embedded )


Caching of data access via
EclipseLink

2
nd

level cache

Abstracting the
Data Modeling Challenge

Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

14

JPA
:

Java Persistence API

JAXB
:

Java Architecture for XML
Binding

DBWS:
EclipseLink

Database
WebServices

CUST

ID

NAME

C_RATING

Relational

Customer

id:
int

name: String

creditRating
:
int

Java


<
customer id=“…”>


<name>…</name
>


<contact
-
info>





</
contact
-
info>

</customer>

XML

JPA

JAXB

NoSQL



?

Java
Persistence

The Problem
Space

Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

15

JPA
-

Background


A standardization of industry practices for Java POJO Object
Relational Persistence


Suitable for use in different modes


Standalone in Java SE environment


Hosted within a Java EE Container


Merging of expertise from persistence vendors and communities
including:
TopLink, Hibernate, JDO, EJB vendors and
individuals


Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

16

DEFINES:


How Java objects are stored in relational
db


A programmer API for reading, writing, and
querying persistent Java objects (“Entities”)


A full featured query language in JP QL


a container contract that supports plugging
any JPA runtime in to any compliant container


Java Persistence API (JPA)
-

in a Nutshell

Java Classes

Database Schema

Application

JDBC Driver

JPA Provider

Persistence

Descriptors

Java SE/EE

Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

17

EclipseLink Project


Founded by open sourcing Oracle TopLink at Eclipse Foundation


Object
-
Relational: Java Persistence API (JPA)


JPA
1.0, 2.0, and 2.1 compliant


EclipseLink
is
JPA 2.0 & 2.1 Reference
Implementation


Sophisticated
L2 and Clustered Caching Infrastructure


Object
-
XML: Java Architecture for XML Binding (JAXB)


JAXB 2.2 Certified Implementation


Additional features include: JSON Binding, DBWS
, & JPA
-
RS

www.eclipse.org
/
eclipselink

Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

18

JPA
-
RS



JPA
-
RS



JAX
-
RS

Accounting PU

Human Resources PU

Contracting PU

...



JPA

GET http://.../persistence/Accounting/Invoice/...

JPA
-
RS maps URI
http://.../persistence/
Accounting
/
Invoice
/...

to
Accounting

PU and
Invoice

entity

JAX
-
RS http://.../
persistence
/Accounting/Invoice/...

mapped to
JPA
-
RS

service

Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

19

JPA
-
RS Features


Access
database data
through REST with JSON or XML


Provides REST operations for entities in persistence unit (GET, PUT,
POST, DELETE)


Automatic generation of XML and JSON bindings


Supports invocation of named queries via HTTP


Server Caching

EclipseLink clustered
cache



Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

20

NoSQL

Databases


No
common definition (document, graph, columnar)


Differing feature sets


Some offer query language/API

some not


No standards


Every database offers a unique API


Cost in terms of learning


Zero portability across databases


Challenges

Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

21

EclipseLink
NoSQL


Support
JPA
-
style
access to
NoSQL

databases


Leverage non
-
relational database support for JCA (and JDBC when
available)


Define annotations and XML to identify
NoSQL

stored entities (e.g.,
@
NoSQL
)


Support JPQL subset for each


Key principal: leverage what’s available


Initial support for
MongoDB

and Oracle
NoSQL

Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

22

Applicability of JPA to
NoSQL


Core JPA concepts apply to
NoSQL
:


Persistent Entities,
Embeddables
,
ElementCollection
,
OneToOne
,
OneToMany
,
ManyToOne
, Version, etc.


Some concepts apply sometimes:


JPQL,
NamedNativeQuery



Pure relational concepts don’t apply:


CollectionTable
, Column,
SecondaryTable
,
SequenceGenerator
,

TableGenerator
, etc.


Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

23

EclipseLink
NoSQL

for ONDB


Mapping
Major Keys


Avro Serialization and
Mapping


Native Minor Key
Mapping


Querying

Challenges

Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

24

EclipseLink
NoSQL

for ONDB

Deep Dive

Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

25

Q & A

Copyright

©

2012, Oracle and/or its affiliates. All rights reserved.

26