SlideShare a Scribd company logo
NoSQL Endgame
Otávio Santana
Werner Keil
Werner Keil
Jakarta EE Specification Committee Member
Let’s meet
@emilyfhjiang
@wernerwedge
Emily Jiang
Cloud Native Architect, IBM
3
5 trends in 2023
New digital trends create new technical
challenges
@emilyfhjiang
@wernerwedge
What are these challenges?
@emilyfhjiang
@wernerwedge
• Agile development process
• High performance and availability
• Manage huge data volumes
NoSQL FTW!
Advantages of NoSQL
@emilyfhjiang
@wernerwedge
• Handles large volumes of data at high-speed
• Stores unstructured, semi-structured, or structured
data
• Easy updates to schemas and fields
• Developer-friendly
• Takes advantage of the cloud to deliver zero
downtime
Why this talk
Tons of persistence frameworks
Which one performs best for your case?
JVM can cope with heavy loads
Would normally take ages to compare
NoSQL
01 Database
02 Doesn't use (semi)structure
03 No transactions
04 BASE
Four different types
05
Key-Value stores
AmazonS3
Apollo
Ares
Aphrodite
Sun
War
Love Beauty
AmazonDynamo
Hazelcast
Redis
Column-Oriented
Apollo
Aphrodite
Ares
Kratos
Duty
Duty
Duty
Dead Gods
Love, happy
Sun
War
13
Color
weapon
Sword
Row-key Columns
HBase
Scylla
SimpleDB
Cassandra
DynamoDB
Clouddata
Document stores
{
"name":"Diana",
"duty":[
"Hunt",
"Moon",
"Nature"
],
"siblings":{
"Apollo":"brother"
}
}
ApacheCouchDB
MongoDB
Couchbase
Graph databases
Apollo Ares
Kratos
was killed by was killed by
killed killed
Neo4j
InfoGrid
Sones
HyperGraphDB
Time series
InfluxDB
KairosDB
TimescaleDB
Multi-Model
01
02
03
04
OrientDB (graph, document)
Couchbase (key value, document)
Elasticsearch (document, graph)
ArangoDB (document, graph, key-value)
SQL vs NoSQL
SQL KEY-VALUE COLUMN DOCUMENTS GRAPH
Table Bucket Column family Collection
Row Key/value pair Column Documents Vertex
Column Key/value pair Key/value pair Vertex and
Edge property
Relationship Link Edge
BASE vs ACID
• Basically Available
• Soft state
• Eventual consistency
• Atomicity
• Consistency
• Isolation
• Durability
CAP
Scalability vs Complexity
Scalability
Complexity
key-value
Column
Document
Graph
Relational Application NoSQL Application
Logic Tier Logic Tier
DAO DAO
JPA
JPA
JPA
JPA
JDBC JDBC
JDBC
JDBC
Data Tier
API
API API
Data Tier
Our comparison model
JPA problem for NoSQL
01
02
03
04
05
06
Saves Async
Async Callback
Time to Live (TTL)
Consistency Level
SQL based
Diversity in NoSQL
Annotated Entities
01
02
03
Mapped Superclass
Entity
Column
@Entity(”person")
public class Person {
@Column
private String name;
@Column
private long age;
@Column
private Set<String> powers;
}
Template
Person artemis = ...;
DocumentTemplate template = …
template.insert(artemis);
template.update(artemis);
DocumentQuery query = ...
List<Person> people = template.select(query);
Repository
interface PeopleRepository extends MongoRepository<Person, String> {
List<Person> findByNameAndAge (String name, Integer age);
}
Micronaut Data
NoSQL
Repository
@MongoRepository
interface BookRepository extends CrudRepository<Book, ObjectId> {
Book find(String title);
}
Or
@MongoRepository
public abstract class AbstractBookRepository implements CrudRepository<Book, ObjectId>
{
public abstract List<Book> findByTitle(String title);
}
Entity
@MappedEntity
public class Book {
@Id
@GeneratedValue
private ObjectId id;
private String title;
private int pages;
public Book(String title, int pages) {
this.title = title;
this.pages = pages;
}
// ...
}
Query by Text
@MongoFindQuery(filter = "{title:{$regex: :t}}", sort = "{title: 1}")
List<Book> customFind(String t);
@MongoAggregateQuery("[{$match: {name:{$regex: :t}}}, {$sort: {name: 1}}, {$project:
{name: 1}}]")
List<Person> customAggregate(String t);
@MongoUpdateQuery(filter = "{title:{$regex: :t}}", update = "{$set:{name: 'tom'}}")
List<Book> customUpdate(String t);
@MongoDeleteQuery(filter = "{title:{$regex: :t}}", collation = "{locale:'en_US',
numericOrdering:true}")
void customDelete(String t);
GORM
NoSQL
Entity
@Entity
class User {
ObjectId id
String emailAddress
String password
String fullname
Date dateCreated
Date lastUpdated
static constraints = {
emailAddress email: true
password nullable: true
fullname blank: false
}
}}
@Document(collection = ”people")
public class person { … }
interface GodRepository extends
MongoRepository<Person, String> { … }
What about the Controller?
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
spring.data.mongodb.database=mythology
spring.data.mongodb.port=27017
Logistics Domain
Our example
MovieEntity
MovieRepository
PersonEntity
Roles
…
Other reactive dependencies
…
<dependency>
<groupId>org.neo4j.springframework.data</groupId>
<artifactId>spring-data-neo4j-rx-spring-boot-starter</artifactId>
<version>1.1.1</version>
</dependency>
org.neo4j.driver.uri=bolt://localhost:7687
org.neo4j.driver.authentication.username=neo4j
org.neo4j.driver.authentication.password=secret
Logistics Domain
Repository
public interface MovieRepository extends
ReactiveNeo4jRepository<MovieEntity, String> {
Mono<MovieEntity> findOneByTitle(String title);
}
Entities
@Node("Person")
public class PersonEntity {
@Id
private final String name;
private final Integer born;
}
@Node("Movie")
public class MovieEntity {
@Id
private final String title;
@Property("tagline")
private final String description;
@Relationship(type = "ACTED_IN", direction = INCOMING)
private Map<PersonEntity, Roles> actorsAndRoles =
new HashMap<>();
@Relationship(type = "DIRECTED", direction = INCOMING)
private List<PersonEntity> directors = new ArrayList<>();
}
Relationships
@RelationshipProperties
public class Roles {
private final List<String> roles;
public Roles(List<String> roles) {
this.roles = roles;
}
}
Quarkus
NoSQL
Entity
public class Person extends PanacheMongoEntity {
public String name;
public LocalDate birthDate;
public Status status;
// return name as uppercase in the model
public String getName(){
return name.toUpperCase();
}
// store all names in lowercase in the DB
public void setName(String name){
this.name = name.toLowerCase();
}
}
Repository
@ApplicationScoped
public class PersonRepository implements
PanacheMongoRepository<Person> {
// put your custom logic here as instance methods
public Person findByName(String name){
return find("name", name).firstResult();
}
public List<Person> findAlive(){
return list("status", Status.ALIVE);
}
public void deleteLoics(){
delete("name", "Loïc");
}
}
Motivation
BaseDocument baseDocument = new BaseDocument();
baseDocument.addAttribute(name, value);
Document document = new Document();
document.append(name, value);
JsonObject jsonObject = JsonObject.create();
jsonObject.put(name, value);
ODocument document = new ODocument(“collection”);
document.field(name, value);
Make NoSQL easier
@Inject
Template template;
…
template.insert(book);
List<Book> books = template.select(Book.class)
.where("title").eq("Effective Java").list();
Entity
@Entity
public class Person{
@Id
private String id;
@Column
private String name;
@Column
private String city;
}
@Entity
public record Book(@Id String id,
@Column("title") String title,
@Column("edition") int edition){}
Entity
@Entity
public class Person{
@Id
private String id;
@Column
private String name;
@Column
private String city;
}
key value
key
key
key
value
value
value
Column Family
Graph
Document
Key Value
Template
@Inject
Template template;
...
Car ferrari =
template.insert(ferrari);
Optional<Car> car = template.find(Car.class, 1L);
List<Car> cars = template.select(Car.class).where("city").eq("Rome").result();
template.delete(Car.class).where("id").eq(1L).execute();
Optional<Car> result = template.singleResult("select * from Car where id = 1");
Templates
Template
DocumentTemplate
KeyValueTemplate
VendorTemplate VendorTemplate
GraphTemplate ColumnTemplate
Now What?
Jakarta Data is to unify the data access world!
@emilyfhjiang
@wernerwedge
https://github.com/jakartaee/data
Jakarta Data
NoSQL
JPA
Rest Client
Jakarta Data
relational
database
business
logic
repository
interface
repository
interface
Jakarta Data Provider
NoSQL
database
Jakarta Data / Jakarta
NoSQL Provider
JPA or
JDBC
Jakarta Data Key Elements
ENTITY
REPOSITY
Define methods to
perform CRUD
RESTful Service
Performing CRUD
Basic Entity and Repository
▪ DataRepository doesn’t come with any built-in methods. To further simplify…
@Inject
Products products;
…
products.save(new Product(1, "$25 gift card", 25.0f));
List<Product> found = products.findByPriceLessThan(100.0f);
@Repository
public interface Products extends DataRepository<Product, Long> {
List<Product> findByPriceLessThan(float maxPrice);
void save(Product product);
...
}
public record Product(
long id,
String name,
float price
);
entity class
key type
Basic Entity and CRUD Repository
@Inject
Products products;
…
products.save(new Product(1, "$25 gift card", 25.0f));
List<Product> found = products.findByPriceLessThan(100.0f);
@Repository
public interface Products extends CrudRepository<Product, Long> {
List<Product> findByPriceLessThan(float maxPrice);
...
}
public record Product(
long id,
String name,
float price
);
entity class
key type
save(E entity);
saveAll(Iterable<E> entities);
findAll();
findById(K id);
existsById(K id);
delete(E entity);
deleteById(K id);
...
Inherited via CrudRepository:
Pageable Repository
@Repository
public interface ProductRepository extends PageableRepository<Product, Long> {
Page<Car> findByTypeOrderByName(CarType type, Pageable pageable);
}
Name-Pattern Repository Methods
Compose your own save, findBy, deleteBy, countBy & more methods by
following precise naming conventions with reserved keywords and entity
property names within the method name.
Product[] findByNameLikeAndPriceBetween(String namePattern,
float minPrice,
float maxPrice);
find...By indicates a query returning results
And keyword separates NameLike and PriceBetween conditions
Name and Price are entity property names
Like keyword is a type of condition, requires 1 parameter
Between keyword is a type of condition, requires 2 parameters
Repository with Queries
Some queries are too complex to be defined within a method name.
@Query gives you a way to supply a query written in:
JPQL (for Jakarta Persistence-based providers)
@Repository
public interface Products extends CrudRepository<Product, Long> {
@Query("UPDATE Product o SET o.price = o.price - o.price * ?1")
int discountAll(float discountRate);
}
Named Parameters
If you prefer to use named parameters, you can do that with @Param,
@Repository
public interface Products extends CrudRepository<Product, Long> {
@Query("UPDATE Product o SET o.price = o.price - o.price * :rate")
int discountAll(@Param("rate") float discountRate);
}
Sorting of Results
Reserved keywords OrderBy, Asc, and Desc enable sorting of results.
Product[] findByNameLikeAndPriceBetweenOrderByPriceDescNameAsc(String namePattern,
float minPrice,
float maxPrice);
OrderBy keyword indicates the start of the sorting criteria
Asc keyword indicates ascending sort
Desc keyword indicates descending sort
Sorting of Results – better ways
@OrderBy(value = "price", descending = true)
@OrderBy("name")
Product[] findByNameLikeAndPriceBetween(String namePattern,
float minPrice,
float maxPrice);
Method names can get a bit lengthy, so there is also
@OrderBy annotation for sorting criteria that is known in advance
Sort parameters for dynamic sorting
Product[] findByNameLikeAndPriceBetween(String namePattern,
float minPrice,
float maxPrice,
Sort...);
found = products.findByNameLikeAndPriceBetween(namePattern, 10.00f, 20.00f,
Sort.desc("price"), Sort.asc("name"));
Without Method Name Magic?
@Filter(by = "price", op = Compare.Between)
@Filter(by = "name", fn = Function.IgnoreCase, op = Compare.Contains)
@OrderBy("price")
Product[] inPriceRange(float min, float max, String namePattern);
@Filter(by = "name")
@Update(attr = "price", op = Operation.Multiply)
boolean inflatePrice(String productName, float rate);
@Delete
@Filter(by = "reviews", op = Compare.Empty)
int removeUnreviewed();
It could be possible to define queries entirely with annotations.
• This idea was deferred to post v1.0, but Open Liberty has it working in
a prototype:
Javadoc:
https://ibm.biz/JakartaData
Limiting the Number of Results
@OrderBy("price")
Product[] findFirst10ByNameLike(String namePattern);
Sometimes you don’t want to read the entire matching dataset and only
care about the first several results.
First keyword indicates the start of the sorting criteria
10 numeric value optionally indicates how many.
When absent, only the very first result is returned.
Another way:
@OrderBy("price")
Product[] findByNameLike(String namePattern, Limit limit);
found = products.findByNameLike(namePattern, Limit.of(10));
Offset Pagination
@OrderBy("price")
@OrderBy("name")
Page<Product> findByNameLikeAndPriceBetween(String namePattern,
float minPrice,
float maxPrice,
Pageable pagination);
For large datasets, you can read data in pages, defined by the Pageable parameter,
Offset pagination is convenient to users jumping multiple pages ahead or behind.
But it’s inefficient in making the database fetch unwanted results, and
if data is modified, some results might be missed or duplicated between pages!
for (Pageable p = Pageable.ofSize(50); p != null; ) {
Page<product> page = products.findByNameLikeAndPriceBetween(pattern, 40.0f, 60.0f, p);
...
p = page.nextPageable();
}
Keyset Pagination
Reduces scenarios where results are missed or duplicated across pages.
• Entity properties that serve as the sort criteria must not be modified.
Gives the Pageable awareness of cursor position from a prior page.
• Jakarta Data provider automatically adds conditions to the query
making the previous cursor the starting point for the next page.
Can be more efficient because it does not require fetching and skipping
large numbers of results. Unwanted results never match to begin with!
Keyset Pagination Examples
@OrderBy("lastName")
@OrderBy("id")
KeysetAwarePage<Employee> findByHoursWorkedGreaterThanEqual(int minHours, Pageable pagination);
Traversing all results,
Or relative to a specific position,
for (Pageable p = Pageable.ofSize(100); p != null; ) {
KeysetAwarePage<Employee> page = employees.findByHoursWorkedGreaterThanEqual(1500, p);
...
p = page.nextPageable();
}
Pageable p = Pageable.ofSize(100).afterKeyset(employee.lastName, employee.id);
page = employees.findByHoursWorkedGreaterThanEqual(1500, p);
Order of keyset keys matches
the order of sort criteria
Keyset Pagination – How it Works
@OrderBy("lastName")
@OrderBy("firstName")
@OrderBy("id")
KeysetAwarePage<Employee> findByHoursWorkedGreaterThanEqual(int minHours, Pageable pagination);
Let’s visualize what this could look like if transformed to JPQL:
SELECT o FROM Employee o WHERE (o.hoursWorked >= ?1)
AND ( (o.lastName > ?2)
OR (o.lastName = ?2 AND o.firstName > ?3)
OR (o.lastName = ?2 AND o.firstName = ?3 AND o.id > ?4) )
pagination.getKeysetCursor()
provides the values for ?2, ?3, ?4
Jakarta Data Demo on Open Liberty
@emilyfhjiang
@wernerwedge
https://github.com/OpenLiberty/sample-jakarta-data
Demo
Entity:
CrewMember
Repository:
CrewMembers
CRUD Service
CrewService
@Inject
CrewMembers crewMembers;
…
@DELETE
@Path("/{id}")
public String remove(@PathParam("id") String id)
{
crewMembers.deleteByCrewID(id);
return "";
}
@Repository
public interface CrewMembers extends
DataRepository<CrewMember, String> {
@OrderBy("crewID")
List<CrewMember> findAll();
void deleteByCrewID(String crewID);
void save(CrewMember a);
}
@Entity
public class CrewMember {
@NotEmpty(message = "All crew members must have a name!")
private String name;
@Pattern(regexp = "(Captain|Officer|Engineer)", message =
"Crew member must be one of the listed ranks!")
private String rank;
@Id
@Pattern(regexp = "^d+$", message = "ID Number must be a
non-negative integer!")
private String crewID;
▪ GitHub repositories
▪ https://github.com/OpenLiberty/sample-jakarta-data
▪ Project page
▪ http://jnosql.org
▪ Specifications
▪ Jakarta Data: https://jakarta.ee/specifications/data/
@ wernerwedge
Links
@emilyfhjiang
• Flaticon.com
• Michael Simons
• Jean Tessier
• Teo Bais
• Nathan Rauh
• Mark Swatosh
• Otavio Santana
Credits
@emilyfhjiang
@wernerwedge
Thank You!
@emilyfhjiang
@ wernerwedge

More Related Content

What's hot

Relational database system for restaurant
Relational database system for restaurantRelational database system for restaurant
Relational database system for restaurant
Logedi Lusala
 
Cross-Validation Rules: Tips to Optimize your GL
Cross-Validation Rules: Tips to Optimize your GLCross-Validation Rules: Tips to Optimize your GL
Cross-Validation Rules: Tips to Optimize your GL
eprentise
 
Oracle PBCS Calculating Depreciation
Oracle PBCS Calculating DepreciationOracle PBCS Calculating Depreciation
Oracle PBCS Calculating Depreciation
Rati Sharma
 
Fiwi
FiwiFiwi
MySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxMySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptx
NeoClova
 
Sql Server Basics
Sql Server BasicsSql Server Basics
Sql Server Basics
rainynovember12
 
Azure SQL Database Managed Instance - technical overview
Azure SQL Database Managed Instance - technical overviewAzure SQL Database Managed Instance - technical overview
Azure SQL Database Managed Instance - technical overview
George Walters
 
Optimize the performance, cost, and value of databases.pptx
Optimize the performance, cost, and value of databases.pptxOptimize the performance, cost, and value of databases.pptx
Optimize the performance, cost, and value of databases.pptx
IDERA Software
 
Automating Security Management in PBCS!
Automating Security Management in PBCS!Automating Security Management in PBCS!
Automating Security Management in PBCS!
Dayalan Punniyamoorthy
 
Call report from x++
Call report from x++Call report from x++
Call report from x++Ahmed Farag
 
Microservice architecture - معماری مایکروسرویس
Microservice architecture - معماری مایکروسرویسMicroservice architecture - معماری مایکروسرویس
Microservice architecture - معماری مایکروسرویس
Amir Mahjoorian
 
Oracle 12c Multi Process Multi Threaded
Oracle 12c Multi Process Multi ThreadedOracle 12c Multi Process Multi Threaded
Oracle 12c Multi Process Multi Threaded
Markus Flechtner
 
Oracle architecture ppt
Oracle architecture pptOracle architecture ppt
Oracle architecture ppt
Deepak Shetty
 
SSRS for DBA's
SSRS for DBA'sSSRS for DBA's
SSRS for DBA's
Jonathan Bloom
 
P R A C T I C A
P R A C T I C AP R A C T I C A
P R A C T I C ADanica M
 
Introducing Oracle Fusion Middleware 12.1.3 and especially SOA Suite and BPM ...
Introducing Oracle Fusion Middleware 12.1.3 and especially SOA Suite and BPM ...Introducing Oracle Fusion Middleware 12.1.3 and especially SOA Suite and BPM ...
Introducing Oracle Fusion Middleware 12.1.3 and especially SOA Suite and BPM ...
Lucas Jellema
 
Troubleshooting tips and tricks for Oracle Database Oct 2020
Troubleshooting tips and tricks for Oracle Database Oct 2020Troubleshooting tips and tricks for Oracle Database Oct 2020
Troubleshooting tips and tricks for Oracle Database Oct 2020
Sandesh Rao
 
Database Review for Midterm Exam
Database Review for Midterm ExamDatabase Review for Midterm Exam
Database Review for Midterm Exam
kunemata
 

What's hot (20)

Relational database system for restaurant
Relational database system for restaurantRelational database system for restaurant
Relational database system for restaurant
 
Cross-Validation Rules: Tips to Optimize your GL
Cross-Validation Rules: Tips to Optimize your GLCross-Validation Rules: Tips to Optimize your GL
Cross-Validation Rules: Tips to Optimize your GL
 
Oracle PBCS Calculating Depreciation
Oracle PBCS Calculating DepreciationOracle PBCS Calculating Depreciation
Oracle PBCS Calculating Depreciation
 
Fiwi
FiwiFiwi
Fiwi
 
MySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxMySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptx
 
Sql Server Basics
Sql Server BasicsSql Server Basics
Sql Server Basics
 
Azure SQL Database Managed Instance - technical overview
Azure SQL Database Managed Instance - technical overviewAzure SQL Database Managed Instance - technical overview
Azure SQL Database Managed Instance - technical overview
 
Optimize the performance, cost, and value of databases.pptx
Optimize the performance, cost, and value of databases.pptxOptimize the performance, cost, and value of databases.pptx
Optimize the performance, cost, and value of databases.pptx
 
Automating Security Management in PBCS!
Automating Security Management in PBCS!Automating Security Management in PBCS!
Automating Security Management in PBCS!
 
Call report from x++
Call report from x++Call report from x++
Call report from x++
 
Microservice architecture - معماری مایکروسرویس
Microservice architecture - معماری مایکروسرویسMicroservice architecture - معماری مایکروسرویس
Microservice architecture - معماری مایکروسرویس
 
Oracle 12c Multi Process Multi Threaded
Oracle 12c Multi Process Multi ThreadedOracle 12c Multi Process Multi Threaded
Oracle 12c Multi Process Multi Threaded
 
Oracle architecture ppt
Oracle architecture pptOracle architecture ppt
Oracle architecture ppt
 
SSRS for DBA's
SSRS for DBA'sSSRS for DBA's
SSRS for DBA's
 
Lecture2 oracle ppt
Lecture2 oracle pptLecture2 oracle ppt
Lecture2 oracle ppt
 
P R A C T I C A
P R A C T I C AP R A C T I C A
P R A C T I C A
 
Introducing Oracle Fusion Middleware 12.1.3 and especially SOA Suite and BPM ...
Introducing Oracle Fusion Middleware 12.1.3 and especially SOA Suite and BPM ...Introducing Oracle Fusion Middleware 12.1.3 and especially SOA Suite and BPM ...
Introducing Oracle Fusion Middleware 12.1.3 and especially SOA Suite and BPM ...
 
Sadcw 6e chapter5
Sadcw 6e chapter5Sadcw 6e chapter5
Sadcw 6e chapter5
 
Troubleshooting tips and tricks for Oracle Database Oct 2020
Troubleshooting tips and tricks for Oracle Database Oct 2020Troubleshooting tips and tricks for Oracle Database Oct 2020
Troubleshooting tips and tricks for Oracle Database Oct 2020
 
Database Review for Midterm Exam
Database Review for Midterm ExamDatabase Review for Midterm Exam
Database Review for Midterm Exam
 

Similar to JakartaData-JCon.pptx

NoSQL Endgame Percona Live Online 2020
NoSQL Endgame Percona Live Online 2020NoSQL Endgame Percona Live Online 2020
NoSQL Endgame Percona Live Online 2020
Thodoris Bais
 
NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020
Thodoris Bais
 
NoSQL Endgame - Java2Days 2020 Virtual
NoSQL Endgame - Java2Days 2020 VirtualNoSQL Endgame - Java2Days 2020 Virtual
NoSQL Endgame - Java2Days 2020 Virtual
Werner Keil
 
NoSQL, no Limits, lots of Fun!
NoSQL, no Limits, lots of Fun!NoSQL, no Limits, lots of Fun!
NoSQL, no Limits, lots of Fun!
Otávio Santana
 
EclipseCon 2021 NoSQL Endgame
EclipseCon 2021 NoSQL EndgameEclipseCon 2021 NoSQL Endgame
EclipseCon 2021 NoSQL Endgame
Thodoris Bais
 
NyaruDBにゃるものを使ってみた話 (+Realm比較)
NyaruDBにゃるものを使ってみた話 (+Realm比較)NyaruDBにゃるものを使ってみた話 (+Realm比較)
NyaruDBにゃるものを使ってみた話 (+Realm比較)
Masaki Oshikawa
 
Easy data-with-spring-data-jpa
Easy data-with-spring-data-jpaEasy data-with-spring-data-jpa
Easy data-with-spring-data-jpa
Staples
 
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
tdc-globalcode
 
Let's talk about NoSQL Standard
Let's talk about NoSQL StandardLet's talk about NoSQL Standard
Let's talk about NoSQL Standard
Otavio Santana
 
Let's talk about NoSQL Standard
Let's talk about NoSQL StandardLet's talk about NoSQL Standard
Let's talk about NoSQL Standard
Otávio Santana
 
Dicoding Developer Coaching #19: Android | Menyimpan Database Secara Local di...
Dicoding Developer Coaching #19: Android | Menyimpan Database Secara Local di...Dicoding Developer Coaching #19: Android | Menyimpan Database Secara Local di...
Dicoding Developer Coaching #19: Android | Menyimpan Database Secara Local di...
DicodingEvent
 
Data access 2.0? Please welcome: Spring Data!
Data access 2.0? Please welcome: Spring Data!Data access 2.0? Please welcome: Spring Data!
Data access 2.0? Please welcome: Spring Data!
Oliver Gierke
 
Intro to GraphQL on Android with Apollo DroidconNYC 2017
Intro to GraphQL on Android with Apollo DroidconNYC 2017Intro to GraphQL on Android with Apollo DroidconNYC 2017
Intro to GraphQL on Android with Apollo DroidconNYC 2017
Mike Nakhimovich
 
NoSQL Endgame JCON Conference 2020
NoSQL Endgame JCON Conference 2020NoSQL Endgame JCON Conference 2020
NoSQL Endgame JCON Conference 2020
Thodoris Bais
 
Ejb3 Struts Tutorial En
Ejb3 Struts Tutorial EnEjb3 Struts Tutorial En
Ejb3 Struts Tutorial EnAnkur Dongre
 
Ejb3 Struts Tutorial En
Ejb3 Struts Tutorial EnEjb3 Struts Tutorial En
Ejb3 Struts Tutorial EnAnkur Dongre
 
Coding Ajax
Coding AjaxCoding Ajax
Coding Ajax
Ted Husted
 
Intake 38 data access 5
Intake 38 data access 5Intake 38 data access 5
Intake 38 data access 5
Mahmoud Ouf
 
Spring data
Spring dataSpring data
Spring data
명철 강
 
Next-generation API Development with GraphQL and Prisma
Next-generation API Development with GraphQL and PrismaNext-generation API Development with GraphQL and Prisma
Next-generation API Development with GraphQL and Prisma
Nikolas Burk
 

Similar to JakartaData-JCon.pptx (20)

NoSQL Endgame Percona Live Online 2020
NoSQL Endgame Percona Live Online 2020NoSQL Endgame Percona Live Online 2020
NoSQL Endgame Percona Live Online 2020
 
NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020
 
NoSQL Endgame - Java2Days 2020 Virtual
NoSQL Endgame - Java2Days 2020 VirtualNoSQL Endgame - Java2Days 2020 Virtual
NoSQL Endgame - Java2Days 2020 Virtual
 
NoSQL, no Limits, lots of Fun!
NoSQL, no Limits, lots of Fun!NoSQL, no Limits, lots of Fun!
NoSQL, no Limits, lots of Fun!
 
EclipseCon 2021 NoSQL Endgame
EclipseCon 2021 NoSQL EndgameEclipseCon 2021 NoSQL Endgame
EclipseCon 2021 NoSQL Endgame
 
NyaruDBにゃるものを使ってみた話 (+Realm比較)
NyaruDBにゃるものを使ってみた話 (+Realm比較)NyaruDBにゃるものを使ってみた話 (+Realm比較)
NyaruDBにゃるものを使ってみた話 (+Realm比較)
 
Easy data-with-spring-data-jpa
Easy data-with-spring-data-jpaEasy data-with-spring-data-jpa
Easy data-with-spring-data-jpa
 
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
 
Let's talk about NoSQL Standard
Let's talk about NoSQL StandardLet's talk about NoSQL Standard
Let's talk about NoSQL Standard
 
Let's talk about NoSQL Standard
Let's talk about NoSQL StandardLet's talk about NoSQL Standard
Let's talk about NoSQL Standard
 
Dicoding Developer Coaching #19: Android | Menyimpan Database Secara Local di...
Dicoding Developer Coaching #19: Android | Menyimpan Database Secara Local di...Dicoding Developer Coaching #19: Android | Menyimpan Database Secara Local di...
Dicoding Developer Coaching #19: Android | Menyimpan Database Secara Local di...
 
Data access 2.0? Please welcome: Spring Data!
Data access 2.0? Please welcome: Spring Data!Data access 2.0? Please welcome: Spring Data!
Data access 2.0? Please welcome: Spring Data!
 
Intro to GraphQL on Android with Apollo DroidconNYC 2017
Intro to GraphQL on Android with Apollo DroidconNYC 2017Intro to GraphQL on Android with Apollo DroidconNYC 2017
Intro to GraphQL on Android with Apollo DroidconNYC 2017
 
NoSQL Endgame JCON Conference 2020
NoSQL Endgame JCON Conference 2020NoSQL Endgame JCON Conference 2020
NoSQL Endgame JCON Conference 2020
 
Ejb3 Struts Tutorial En
Ejb3 Struts Tutorial EnEjb3 Struts Tutorial En
Ejb3 Struts Tutorial En
 
Ejb3 Struts Tutorial En
Ejb3 Struts Tutorial EnEjb3 Struts Tutorial En
Ejb3 Struts Tutorial En
 
Coding Ajax
Coding AjaxCoding Ajax
Coding Ajax
 
Intake 38 data access 5
Intake 38 data access 5Intake 38 data access 5
Intake 38 data access 5
 
Spring data
Spring dataSpring data
Spring data
 
Next-generation API Development with GraphQL and Prisma
Next-generation API Development with GraphQL and PrismaNext-generation API Development with GraphQL and Prisma
Next-generation API Development with GraphQL and Prisma
 

More from EmilyJiang23

Master a Cloud Native Standard - MicroProfile.pdf
Master a Cloud Native Standard - MicroProfile.pdfMaster a Cloud Native Standard - MicroProfile.pdf
Master a Cloud Native Standard - MicroProfile.pdf
EmilyJiang23
 
Hybrid Cloud Application Development without vendor lockin
Hybrid Cloud Application Development without vendor lockinHybrid Cloud Application Development without vendor lockin
Hybrid Cloud Application Development without vendor lockin
EmilyJiang23
 
What need to be mastered as AI-Powered Java Developers
What need to be mastered as AI-Powered Java DevelopersWhat need to be mastered as AI-Powered Java Developers
What need to be mastered as AI-Powered Java Developers
EmilyJiang23
 
LJC-Unconference-2023-Keynote.pdf
LJC-Unconference-2023-Keynote.pdfLJC-Unconference-2023-Keynote.pdf
LJC-Unconference-2023-Keynote.pdf
EmilyJiang23
 
Master a Cloud Native Standard - MicroProfile.pptx
Master a Cloud Native Standard - MicroProfile.pptxMaster a Cloud Native Standard - MicroProfile.pptx
Master a Cloud Native Standard - MicroProfile.pptx
EmilyJiang23
 
OpenCloudNative-BeJUG.pptx
OpenCloudNative-BeJUG.pptxOpenCloudNative-BeJUG.pptx
OpenCloudNative-BeJUG.pptx
EmilyJiang23
 
WillMicroserviceDie.pdf
WillMicroserviceDie.pdfWillMicroserviceDie.pdf
WillMicroserviceDie.pdf
EmilyJiang23
 

More from EmilyJiang23 (7)

Master a Cloud Native Standard - MicroProfile.pdf
Master a Cloud Native Standard - MicroProfile.pdfMaster a Cloud Native Standard - MicroProfile.pdf
Master a Cloud Native Standard - MicroProfile.pdf
 
Hybrid Cloud Application Development without vendor lockin
Hybrid Cloud Application Development without vendor lockinHybrid Cloud Application Development without vendor lockin
Hybrid Cloud Application Development without vendor lockin
 
What need to be mastered as AI-Powered Java Developers
What need to be mastered as AI-Powered Java DevelopersWhat need to be mastered as AI-Powered Java Developers
What need to be mastered as AI-Powered Java Developers
 
LJC-Unconference-2023-Keynote.pdf
LJC-Unconference-2023-Keynote.pdfLJC-Unconference-2023-Keynote.pdf
LJC-Unconference-2023-Keynote.pdf
 
Master a Cloud Native Standard - MicroProfile.pptx
Master a Cloud Native Standard - MicroProfile.pptxMaster a Cloud Native Standard - MicroProfile.pptx
Master a Cloud Native Standard - MicroProfile.pptx
 
OpenCloudNative-BeJUG.pptx
OpenCloudNative-BeJUG.pptxOpenCloudNative-BeJUG.pptx
OpenCloudNative-BeJUG.pptx
 
WillMicroserviceDie.pdf
WillMicroserviceDie.pdfWillMicroserviceDie.pdf
WillMicroserviceDie.pdf
 

Recently uploaded

Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
Jen Stirrup
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
Globus
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 

Recently uploaded (20)

Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 

JakartaData-JCon.pptx

  • 2. Werner Keil Jakarta EE Specification Committee Member Let’s meet @emilyfhjiang @wernerwedge Emily Jiang Cloud Native Architect, IBM
  • 4. New digital trends create new technical challenges @emilyfhjiang @wernerwedge
  • 5. What are these challenges? @emilyfhjiang @wernerwedge • Agile development process • High performance and availability • Manage huge data volumes
  • 7. Advantages of NoSQL @emilyfhjiang @wernerwedge • Handles large volumes of data at high-speed • Stores unstructured, semi-structured, or structured data • Easy updates to schemas and fields • Developer-friendly • Takes advantage of the cloud to deliver zero downtime
  • 8. Why this talk Tons of persistence frameworks Which one performs best for your case? JVM can cope with heavy loads Would normally take ages to compare
  • 9. NoSQL 01 Database 02 Doesn't use (semi)structure 03 No transactions 04 BASE Four different types 05
  • 13. Graph databases Apollo Ares Kratos was killed by was killed by killed killed Neo4j InfoGrid Sones HyperGraphDB
  • 15. Multi-Model 01 02 03 04 OrientDB (graph, document) Couchbase (key value, document) Elasticsearch (document, graph) ArangoDB (document, graph, key-value)
  • 16. SQL vs NoSQL SQL KEY-VALUE COLUMN DOCUMENTS GRAPH Table Bucket Column family Collection Row Key/value pair Column Documents Vertex Column Key/value pair Key/value pair Vertex and Edge property Relationship Link Edge
  • 17. BASE vs ACID • Basically Available • Soft state • Eventual consistency • Atomicity • Consistency • Isolation • Durability
  • 18. CAP
  • 20. Relational Application NoSQL Application Logic Tier Logic Tier DAO DAO JPA JPA JPA JPA JDBC JDBC JDBC JDBC Data Tier API API API Data Tier
  • 22. JPA problem for NoSQL 01 02 03 04 05 06 Saves Async Async Callback Time to Live (TTL) Consistency Level SQL based Diversity in NoSQL
  • 23. Annotated Entities 01 02 03 Mapped Superclass Entity Column @Entity(”person") public class Person { @Column private String name; @Column private long age; @Column private Set<String> powers; }
  • 24. Template Person artemis = ...; DocumentTemplate template = … template.insert(artemis); template.update(artemis); DocumentQuery query = ... List<Person> people = template.select(query);
  • 25. Repository interface PeopleRepository extends MongoRepository<Person, String> { List<Person> findByNameAndAge (String name, Integer age); }
  • 27. Repository @MongoRepository interface BookRepository extends CrudRepository<Book, ObjectId> { Book find(String title); } Or @MongoRepository public abstract class AbstractBookRepository implements CrudRepository<Book, ObjectId> { public abstract List<Book> findByTitle(String title); }
  • 28. Entity @MappedEntity public class Book { @Id @GeneratedValue private ObjectId id; private String title; private int pages; public Book(String title, int pages) { this.title = title; this.pages = pages; } // ... }
  • 29. Query by Text @MongoFindQuery(filter = "{title:{$regex: :t}}", sort = "{title: 1}") List<Book> customFind(String t); @MongoAggregateQuery("[{$match: {name:{$regex: :t}}}, {$sort: {name: 1}}, {$project: {name: 1}}]") List<Person> customAggregate(String t); @MongoUpdateQuery(filter = "{title:{$regex: :t}}", update = "{$set:{name: 'tom'}}") List<Book> customUpdate(String t); @MongoDeleteQuery(filter = "{title:{$regex: :t}}", collation = "{locale:'en_US', numericOrdering:true}") void customDelete(String t);
  • 31. Entity @Entity class User { ObjectId id String emailAddress String password String fullname Date dateCreated Date lastUpdated static constraints = { emailAddress email: true password nullable: true fullname blank: false } }}
  • 32. @Document(collection = ”people") public class person { … } interface GodRepository extends MongoRepository<Person, String> { … } What about the Controller? <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-mongodb</artifactId> </dependency> spring.data.mongodb.database=mythology spring.data.mongodb.port=27017 Logistics Domain
  • 35. Repository public interface MovieRepository extends ReactiveNeo4jRepository<MovieEntity, String> { Mono<MovieEntity> findOneByTitle(String title); }
  • 36. Entities @Node("Person") public class PersonEntity { @Id private final String name; private final Integer born; } @Node("Movie") public class MovieEntity { @Id private final String title; @Property("tagline") private final String description; @Relationship(type = "ACTED_IN", direction = INCOMING) private Map<PersonEntity, Roles> actorsAndRoles = new HashMap<>(); @Relationship(type = "DIRECTED", direction = INCOMING) private List<PersonEntity> directors = new ArrayList<>(); }
  • 37. Relationships @RelationshipProperties public class Roles { private final List<String> roles; public Roles(List<String> roles) { this.roles = roles; } }
  • 39. Entity public class Person extends PanacheMongoEntity { public String name; public LocalDate birthDate; public Status status; // return name as uppercase in the model public String getName(){ return name.toUpperCase(); } // store all names in lowercase in the DB public void setName(String name){ this.name = name.toLowerCase(); } }
  • 40. Repository @ApplicationScoped public class PersonRepository implements PanacheMongoRepository<Person> { // put your custom logic here as instance methods public Person findByName(String name){ return find("name", name).firstResult(); } public List<Person> findAlive(){ return list("status", Status.ALIVE); } public void deleteLoics(){ delete("name", "Loïc"); } }
  • 41. Motivation BaseDocument baseDocument = new BaseDocument(); baseDocument.addAttribute(name, value); Document document = new Document(); document.append(name, value); JsonObject jsonObject = JsonObject.create(); jsonObject.put(name, value); ODocument document = new ODocument(“collection”); document.field(name, value);
  • 42. Make NoSQL easier @Inject Template template; … template.insert(book); List<Book> books = template.select(Book.class) .where("title").eq("Effective Java").list();
  • 43. Entity @Entity public class Person{ @Id private String id; @Column private String name; @Column private String city; } @Entity public record Book(@Id String id, @Column("title") String title, @Column("edition") int edition){}
  • 44. Entity @Entity public class Person{ @Id private String id; @Column private String name; @Column private String city; } key value key key key value value value Column Family Graph Document Key Value
  • 45. Template @Inject Template template; ... Car ferrari = template.insert(ferrari); Optional<Car> car = template.find(Car.class, 1L); List<Car> cars = template.select(Car.class).where("city").eq("Rome").result(); template.delete(Car.class).where("id").eq(1L).execute(); Optional<Car> result = template.singleResult("select * from Car where id = 1");
  • 47. Now What? Jakarta Data is to unify the data access world! @emilyfhjiang @wernerwedge https://github.com/jakartaee/data
  • 49. Jakarta Data relational database business logic repository interface repository interface Jakarta Data Provider NoSQL database Jakarta Data / Jakarta NoSQL Provider JPA or JDBC
  • 50. Jakarta Data Key Elements ENTITY REPOSITY Define methods to perform CRUD RESTful Service Performing CRUD
  • 51. Basic Entity and Repository ▪ DataRepository doesn’t come with any built-in methods. To further simplify… @Inject Products products; … products.save(new Product(1, "$25 gift card", 25.0f)); List<Product> found = products.findByPriceLessThan(100.0f); @Repository public interface Products extends DataRepository<Product, Long> { List<Product> findByPriceLessThan(float maxPrice); void save(Product product); ... } public record Product( long id, String name, float price ); entity class key type
  • 52. Basic Entity and CRUD Repository @Inject Products products; … products.save(new Product(1, "$25 gift card", 25.0f)); List<Product> found = products.findByPriceLessThan(100.0f); @Repository public interface Products extends CrudRepository<Product, Long> { List<Product> findByPriceLessThan(float maxPrice); ... } public record Product( long id, String name, float price ); entity class key type save(E entity); saveAll(Iterable<E> entities); findAll(); findById(K id); existsById(K id); delete(E entity); deleteById(K id); ... Inherited via CrudRepository:
  • 53. Pageable Repository @Repository public interface ProductRepository extends PageableRepository<Product, Long> { Page<Car> findByTypeOrderByName(CarType type, Pageable pageable); }
  • 54. Name-Pattern Repository Methods Compose your own save, findBy, deleteBy, countBy & more methods by following precise naming conventions with reserved keywords and entity property names within the method name. Product[] findByNameLikeAndPriceBetween(String namePattern, float minPrice, float maxPrice); find...By indicates a query returning results And keyword separates NameLike and PriceBetween conditions Name and Price are entity property names Like keyword is a type of condition, requires 1 parameter Between keyword is a type of condition, requires 2 parameters
  • 55. Repository with Queries Some queries are too complex to be defined within a method name. @Query gives you a way to supply a query written in: JPQL (for Jakarta Persistence-based providers) @Repository public interface Products extends CrudRepository<Product, Long> { @Query("UPDATE Product o SET o.price = o.price - o.price * ?1") int discountAll(float discountRate); }
  • 56. Named Parameters If you prefer to use named parameters, you can do that with @Param, @Repository public interface Products extends CrudRepository<Product, Long> { @Query("UPDATE Product o SET o.price = o.price - o.price * :rate") int discountAll(@Param("rate") float discountRate); }
  • 57. Sorting of Results Reserved keywords OrderBy, Asc, and Desc enable sorting of results. Product[] findByNameLikeAndPriceBetweenOrderByPriceDescNameAsc(String namePattern, float minPrice, float maxPrice); OrderBy keyword indicates the start of the sorting criteria Asc keyword indicates ascending sort Desc keyword indicates descending sort
  • 58. Sorting of Results – better ways @OrderBy(value = "price", descending = true) @OrderBy("name") Product[] findByNameLikeAndPriceBetween(String namePattern, float minPrice, float maxPrice); Method names can get a bit lengthy, so there is also @OrderBy annotation for sorting criteria that is known in advance Sort parameters for dynamic sorting Product[] findByNameLikeAndPriceBetween(String namePattern, float minPrice, float maxPrice, Sort...); found = products.findByNameLikeAndPriceBetween(namePattern, 10.00f, 20.00f, Sort.desc("price"), Sort.asc("name"));
  • 59. Without Method Name Magic? @Filter(by = "price", op = Compare.Between) @Filter(by = "name", fn = Function.IgnoreCase, op = Compare.Contains) @OrderBy("price") Product[] inPriceRange(float min, float max, String namePattern); @Filter(by = "name") @Update(attr = "price", op = Operation.Multiply) boolean inflatePrice(String productName, float rate); @Delete @Filter(by = "reviews", op = Compare.Empty) int removeUnreviewed(); It could be possible to define queries entirely with annotations. • This idea was deferred to post v1.0, but Open Liberty has it working in a prototype: Javadoc: https://ibm.biz/JakartaData
  • 60. Limiting the Number of Results @OrderBy("price") Product[] findFirst10ByNameLike(String namePattern); Sometimes you don’t want to read the entire matching dataset and only care about the first several results. First keyword indicates the start of the sorting criteria 10 numeric value optionally indicates how many. When absent, only the very first result is returned. Another way: @OrderBy("price") Product[] findByNameLike(String namePattern, Limit limit); found = products.findByNameLike(namePattern, Limit.of(10));
  • 61. Offset Pagination @OrderBy("price") @OrderBy("name") Page<Product> findByNameLikeAndPriceBetween(String namePattern, float minPrice, float maxPrice, Pageable pagination); For large datasets, you can read data in pages, defined by the Pageable parameter, Offset pagination is convenient to users jumping multiple pages ahead or behind. But it’s inefficient in making the database fetch unwanted results, and if data is modified, some results might be missed or duplicated between pages! for (Pageable p = Pageable.ofSize(50); p != null; ) { Page<product> page = products.findByNameLikeAndPriceBetween(pattern, 40.0f, 60.0f, p); ... p = page.nextPageable(); }
  • 62. Keyset Pagination Reduces scenarios where results are missed or duplicated across pages. • Entity properties that serve as the sort criteria must not be modified. Gives the Pageable awareness of cursor position from a prior page. • Jakarta Data provider automatically adds conditions to the query making the previous cursor the starting point for the next page. Can be more efficient because it does not require fetching and skipping large numbers of results. Unwanted results never match to begin with!
  • 63. Keyset Pagination Examples @OrderBy("lastName") @OrderBy("id") KeysetAwarePage<Employee> findByHoursWorkedGreaterThanEqual(int minHours, Pageable pagination); Traversing all results, Or relative to a specific position, for (Pageable p = Pageable.ofSize(100); p != null; ) { KeysetAwarePage<Employee> page = employees.findByHoursWorkedGreaterThanEqual(1500, p); ... p = page.nextPageable(); } Pageable p = Pageable.ofSize(100).afterKeyset(employee.lastName, employee.id); page = employees.findByHoursWorkedGreaterThanEqual(1500, p); Order of keyset keys matches the order of sort criteria
  • 64. Keyset Pagination – How it Works @OrderBy("lastName") @OrderBy("firstName") @OrderBy("id") KeysetAwarePage<Employee> findByHoursWorkedGreaterThanEqual(int minHours, Pageable pagination); Let’s visualize what this could look like if transformed to JPQL: SELECT o FROM Employee o WHERE (o.hoursWorked >= ?1) AND ( (o.lastName > ?2) OR (o.lastName = ?2 AND o.firstName > ?3) OR (o.lastName = ?2 AND o.firstName = ?3 AND o.id > ?4) ) pagination.getKeysetCursor() provides the values for ?2, ?3, ?4
  • 65. Jakarta Data Demo on Open Liberty @emilyfhjiang @wernerwedge https://github.com/OpenLiberty/sample-jakarta-data
  • 66. Demo Entity: CrewMember Repository: CrewMembers CRUD Service CrewService @Inject CrewMembers crewMembers; … @DELETE @Path("/{id}") public String remove(@PathParam("id") String id) { crewMembers.deleteByCrewID(id); return ""; } @Repository public interface CrewMembers extends DataRepository<CrewMember, String> { @OrderBy("crewID") List<CrewMember> findAll(); void deleteByCrewID(String crewID); void save(CrewMember a); } @Entity public class CrewMember { @NotEmpty(message = "All crew members must have a name!") private String name; @Pattern(regexp = "(Captain|Officer|Engineer)", message = "Crew member must be one of the listed ranks!") private String rank; @Id @Pattern(regexp = "^d+$", message = "ID Number must be a non-negative integer!") private String crewID;
  • 67. ▪ GitHub repositories ▪ https://github.com/OpenLiberty/sample-jakarta-data ▪ Project page ▪ http://jnosql.org ▪ Specifications ▪ Jakarta Data: https://jakarta.ee/specifications/data/ @ wernerwedge Links @emilyfhjiang
  • 68. • Flaticon.com • Michael Simons • Jean Tessier • Teo Bais • Nathan Rauh • Mark Swatosh • Otavio Santana Credits @emilyfhjiang @wernerwedge