SlideShare une entreprise Scribd logo
1  sur  49
Managing Data in
Jakarta EE
Applications
Who am I?
Buhake Sindi
● Senior Full Stack Java Architect &
Engineer/Developer & Consultant
● Over 17+ years in Enterprise Java
development
● Founded Sindi Technologies (Pty) Ltd
● Founded Devoxx4Kids South Africa
(NPO)
● Jakarta EE Ambassador
● Blogger (DZone Core Member)
● Runner, Beat Maker, Podcaster?
Where can you find me?
https://linktr.ee/theEliteGentleman
buhake@gmail.com
www.sindi.co.za
X: @EliteGentleman
Also
Table of contents
Handling data in
the early days
Isolating data
from your
application
Repository
Pattern in
current Jakarta
EE release
Repository in
future release of
Jakarta EE
01 02
03 04
Table of contents
Demo
examples
Q&A
05
06
Handling data in
the early days…
01
Early days…
Monolithic architecture
Vendor-specific APIs
All components (presentation,
business & data access) were tightly
integrated into a single deployment
unit.
Early Java EE specifications were not
as standardized as today. App servers
provided their own specific APIs,
making applications tightly coupled to
the specific application server.
Enterprise Java
Beans (EJBs)
Early versions of EJBs (particularly EJB 2.x)
heavily depended on implementation of EJB
specific interfaces.
Entity Bean was introduced to represent
persistent data maintained in the database.
● Beans were defined to the persistence
management (BMP or CMP).
Difficult to maintain, less flexible &
portable (as it heavily relied on application
server implementation of EJBs)
Challenges…
Limited Separation of concerns
Limited Dependency Injection
Business logic, presentation and
data access were often mixed
Tight integration with JNDI. Also heavy
reliance of XML deployment descriptors
Tight coupling
Limited support for POJOs. Limited code
reusability. Difficulty in testing &
providing mocks.
Big shift to
Enterprise
Application
Architecture,
frameworks and
specifications
EAA and frameworks
Use of Plain-Old-Java-Objects (POJO),
Plain-Old-Java-Interfaces (POJI)
● Specification: Java Data Objects (JDO)
● Data Access Objects (DAO)
● Frameworks: iBatis/myBatis, TopLink,
jOOQ
● ORM: Hibernate
What’s your flavour? Thus, a needed
vendor-agnostic standardisation was
needed for EAA.
Advantages
Portability
Providing a level of
abstraction that is portable
across different data stores.
Consistent API
Standardized API for
interacting with DBs can
help simplify learning curve
for developers & bring
uniform coding style.
Testability
Using POJO, POJI & DI it’s
easier to write unit tests for
business logic.
Separation of
concerns
Isolation of data access
and persistence from
the business logic
Challenges
Performance
Overheads
Depending on specific
implementations and
configurations
Learning Curve
For developers who are new
to these concepts.
Boilerplate code
Implementation of various
framework may introduce
boilerplate code for CRUD
Limited industry
adoption
Various frameworks took
widespread adoptions
compared to other
frameworks
Further Challenges
Vendor focused
Some queries may result
in vendor specific
queries.
Lack of support
for NoSQL DBs
Debugging &
Profiling
Especially with
generated SQL queries
Tight coupling
E.g. change of DB
Schema
Isolating data from
your application
02
Purpose
To separate the data layer and
data access logic from the rest
of your application components.
Key aspects and principles
● Separation of concerns: Keep data access logic separate from the business logic.
● Testability: Make your data access logic easier to write unit test for your business
logic.
● Encapsulation: Hide the details of data storage and retrieval within data access layer.
● Abstraction: Make use of abstract classes and interfaces to define the contract
between the data access layer and the rest of the applications.
● Data Access Layer: Encapsulate all interactions with Data Access Logic.
● Interfaces for Data Access: Clean and well-defined contract for data access
operations (CRUD).
● Use of Design Pattern: DAO / Repository pattern to structure and isolate data access
logic.
● Dependency Injection: Business Logic should depend on Data Access Logic through
abstraction.
● ORM: Usage of JPA/Hibernate allows interactions through POJOs, while abstracting
database interactions.
The Repository pattern
Meets all aspects and principles of data
isolation:
● Data Access Layer.
● Interfaces for Data Access.
● Use of design pattern (also, caching
with strategy pattern?);
● Provides abstraction and loose-
coupling between data access and
rest of your application.
Data
Support many data stores
Support of DI
Relational DBs (JDBC, JPA, Hibernate
Session), NoSQL (MongoDB, Redis,
Cassandra)
Through CDI extensions
Query Methods
Via @Query or Criteria APIs
Repository abstraction
Via interfaces: JpaRepository (for JPA),
CassandraRepository (Cassandra), etc.
Repository Pattern
in current Jakarta
EE release
03
Key aspects
Injectable
With Jakarta CDI @Inject
Testable
Either with jUnit, Mockito, Testcontainers, etc.
Abstractable
Encapsulate Data Access Layer & still
integrate with ORM / JPA, JDBC, etc.
Repository abstraction
Via Repository interface(s)
Deltaspike Data
Support many data stores
Support of DI
JPA centric and relational databases.
No NoSQL support.
Through CDI extensions
Query Methods
Via @Query module (with JPQL
queries)
Repository abstraction
Via @Repository annotation on repository
interface (that extends EntityRepository)
Custom
approach
Best of both Spring Data and Deltaspike Data approach
Domain object
(I) Entity
(I) IdentifiableEntity<ID>
(A) JPAEntity<ID>
(I) CreatedTimestamp
(I) LastModifiedTimestamp
(I) SoftDeletedTimestamp
Domain Entity
Domain objects represent the entities or
business objects in the application's
domain. The repository is responsible for
persisting and retrieving these domain
objects. The use of domain objects
ensures that the data access layer
aligns with the application's business
logic.
Repository
(I) DataRepository<E>
(I) CrudRepository<E, ID> (I) SpecificationRepository
(I) MicrostreamRepository
(I) JPARepository
(I) Specification<E>
(I) CassandraRepository
(A) AbstractJPARepository
The repository pattern is the design pattern, used in software development to create an
abstraction layer between the application’s business logic and the data access code responsible for
interacting with the database or other data sources.
Here’s key component we’ve implemented for our Repository Pattern:
• Repository interface: At the core of the Repository pattern is the interface that defines a
sets of methods for interacting with the data. Each interface abstracts away the data and is
defined for the specific domain entity.
• Super interface: DataRepository
• Sub interface: CrudRepository – Common database operations.
Repository key components
• Concrete Repository implementation: The repository interface
is implemented by a concrete class that provides that actual
implementation of that data access logic. This class interacts
with the underlying data store to execute the defined
operations.
Repository key components
Making CDI injectable
@Repository annotation
A CDI Stereotype annotation that
makes the class a CDI bean when CDI
is available.
The repository implementation must
be made available via the
@jakarta.inject.Inject annotation.
1. Stateless repository: Can inherit state & transactions from
business services (EJB 3.x)
2. Reduced boilerplate code: Abstract classes have implemented
all common database operations.
3. Entity association: E.g., JPARepository is strongly linked to
JPAEntity
Other features
1. Repository interface allows us to create mock implementations
to be used for testing.
2. Suitable for jUnit, Mockito tests.
Testing
Repository in
future release
of Jakarta EE
04
Jakarta Data
Jakarta Data defines core APIs
for the Jakarta EE platform
allowing applications and
other Jakarta EE components
to explore the benefits of easy
access to data technologies
such as relational and non-
relational databases, cloud-
based data services, and so
on.
Goals:
1. Increase productivity performing common database operations.
2. Rich Object Mapping integrated.
3. Define Repositories.
Still under development:
1. Release will support Jakarta EE 11
2. Specification: https://jakarta.ee/specifications/data/1.0/data-
1.0.0-m1
Jakarta Data 1.0
Features:
1. @Repository
2. @Query
3. @Insert, @Update, @Delete
4. @Lifecycle
5. Stateless Repository
6. Built-in interfaces
Jakarta Data 1.0
Currently:
1. In beta on OpenLiberty Beta (23.0.0.12-beta)
2. Include data-1.0 as feature in server.xml
Jakarta Data 1.0
Demo
examples
05
Q&A
Thank you!
Do you have any questions?
buhake@gmail.com
www.sindi.co.za

Contenu connexe

Similaire à Managing Data in Jakarta EE Applications

2008_478_Lyons_ppt.ppt
2008_478_Lyons_ppt.ppt2008_478_Lyons_ppt.ppt
2008_478_Lyons_ppt.pptChadharris42
 
Introduction to j2 ee frameworks
Introduction to j2 ee frameworksIntroduction to j2 ee frameworks
Introduction to j2 ee frameworksMukesh Kumar
 
J2 EEE SIDES
J2 EEE  SIDESJ2 EEE  SIDES
J2 EEE SIDESbputhal
 
Instant J Chem - Introduction and latest
Instant J Chem - Introduction and latestInstant J Chem - Introduction and latest
Instant J Chem - Introduction and latestChemAxon
 
Dao pattern
Dao patternDao pattern
Dao patternciriako
 
Oracle Data Integrator 11g Integration and Administration
Oracle Data Integrator 11g  Integration and AdministrationOracle Data Integrator 11g  Integration and Administration
Oracle Data Integrator 11g Integration and AdministrationMd. Noor Alam
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
 Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1... Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...WebStackAcademy
 
Design patterns fast track
Design patterns fast trackDesign patterns fast track
Design patterns fast trackBinu Bhasuran
 
Whats Next for JCA?
Whats Next for JCA?Whats Next for JCA?
Whats Next for JCA?Fred Rowe
 
TheSpringFramework
TheSpringFrameworkTheSpringFramework
TheSpringFrameworkShankar Nair
 
FIWARE Global Summit - A Multi-database Plugin for the Orion FIWARE Context B...
FIWARE Global Summit - A Multi-database Plugin for the Orion FIWARE Context B...FIWARE Global Summit - A Multi-database Plugin for the Orion FIWARE Context B...
FIWARE Global Summit - A Multi-database Plugin for the Orion FIWARE Context B...FIWARE
 
Session 34 - JDBC Best Practices, Introduction to Design Patterns
Session 34 - JDBC Best Practices, Introduction to Design PatternsSession 34 - JDBC Best Practices, Introduction to Design Patterns
Session 34 - JDBC Best Practices, Introduction to Design PatternsPawanMM
 
OpenProdoc Overview
OpenProdoc OverviewOpenProdoc Overview
OpenProdoc Overviewjhierrot
 
Spring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applicationsSpring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applicationsmichaelaaron25322
 
J2EE PPT --CINTHIYA.M Krishnammal college for women
J2EE PPT --CINTHIYA.M Krishnammal college for womenJ2EE PPT --CINTHIYA.M Krishnammal college for women
J2EE PPT --CINTHIYA.M Krishnammal college for womenlissa cidhi
 
EDB & ELOS Technologies - Break Free from Oracle
EDB & ELOS Technologies - Break Free from OracleEDB & ELOS Technologies - Break Free from Oracle
EDB & ELOS Technologies - Break Free from OracleEDB
 

Similaire à Managing Data in Jakarta EE Applications (20)

2008_478_Lyons_ppt.ppt
2008_478_Lyons_ppt.ppt2008_478_Lyons_ppt.ppt
2008_478_Lyons_ppt.ppt
 
Introduction to j2 ee frameworks
Introduction to j2 ee frameworksIntroduction to j2 ee frameworks
Introduction to j2 ee frameworks
 
J2 EEE SIDES
J2 EEE  SIDESJ2 EEE  SIDES
J2 EEE SIDES
 
Instant J Chem - Introduction and latest
Instant J Chem - Introduction and latestInstant J Chem - Introduction and latest
Instant J Chem - Introduction and latest
 
Data access
Data accessData access
Data access
 
Dao pattern
Dao patternDao pattern
Dao pattern
 
Oracle Data Integrator 11g Integration and Administration
Oracle Data Integrator 11g  Integration and AdministrationOracle Data Integrator 11g  Integration and Administration
Oracle Data Integrator 11g Integration and Administration
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
 Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1... Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 1...
 
Midao JDBC presentation
Midao JDBC presentationMidao JDBC presentation
Midao JDBC presentation
 
Design patterns fast track
Design patterns fast trackDesign patterns fast track
Design patterns fast track
 
spring
springspring
spring
 
Whats Next for JCA?
Whats Next for JCA?Whats Next for JCA?
Whats Next for JCA?
 
TheSpringFramework
TheSpringFrameworkTheSpringFramework
TheSpringFramework
 
FIWARE Global Summit - A Multi-database Plugin for the Orion FIWARE Context B...
FIWARE Global Summit - A Multi-database Plugin for the Orion FIWARE Context B...FIWARE Global Summit - A Multi-database Plugin for the Orion FIWARE Context B...
FIWARE Global Summit - A Multi-database Plugin for the Orion FIWARE Context B...
 
Session 34 - JDBC Best Practices, Introduction to Design Patterns
Session 34 - JDBC Best Practices, Introduction to Design PatternsSession 34 - JDBC Best Practices, Introduction to Design Patterns
Session 34 - JDBC Best Practices, Introduction to Design Patterns
 
OpenProdoc Overview
OpenProdoc OverviewOpenProdoc Overview
OpenProdoc Overview
 
Spring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applicationsSpring data jpa are used to develop spring applications
Spring data jpa are used to develop spring applications
 
70487.pdf
70487.pdf70487.pdf
70487.pdf
 
J2EE PPT --CINTHIYA.M Krishnammal college for women
J2EE PPT --CINTHIYA.M Krishnammal college for womenJ2EE PPT --CINTHIYA.M Krishnammal college for women
J2EE PPT --CINTHIYA.M Krishnammal college for women
 
EDB & ELOS Technologies - Break Free from Oracle
EDB & ELOS Technologies - Break Free from OracleEDB & ELOS Technologies - Break Free from Oracle
EDB & ELOS Technologies - Break Free from Oracle
 

Dernier

(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 

Dernier (20)

(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 

Managing Data in Jakarta EE Applications

  • 1.
  • 2. Managing Data in Jakarta EE Applications
  • 3. Who am I? Buhake Sindi ● Senior Full Stack Java Architect & Engineer/Developer & Consultant ● Over 17+ years in Enterprise Java development ● Founded Sindi Technologies (Pty) Ltd ● Founded Devoxx4Kids South Africa (NPO) ● Jakarta EE Ambassador ● Blogger (DZone Core Member) ● Runner, Beat Maker, Podcaster?
  • 4. Where can you find me? https://linktr.ee/theEliteGentleman buhake@gmail.com www.sindi.co.za X: @EliteGentleman Also
  • 5. Table of contents Handling data in the early days Isolating data from your application Repository Pattern in current Jakarta EE release Repository in future release of Jakarta EE 01 02 03 04
  • 7. Handling data in the early days… 01
  • 8. Early days… Monolithic architecture Vendor-specific APIs All components (presentation, business & data access) were tightly integrated into a single deployment unit. Early Java EE specifications were not as standardized as today. App servers provided their own specific APIs, making applications tightly coupled to the specific application server.
  • 9. Enterprise Java Beans (EJBs) Early versions of EJBs (particularly EJB 2.x) heavily depended on implementation of EJB specific interfaces. Entity Bean was introduced to represent persistent data maintained in the database. ● Beans were defined to the persistence management (BMP or CMP). Difficult to maintain, less flexible & portable (as it heavily relied on application server implementation of EJBs)
  • 10. Challenges… Limited Separation of concerns Limited Dependency Injection Business logic, presentation and data access were often mixed Tight integration with JNDI. Also heavy reliance of XML deployment descriptors Tight coupling Limited support for POJOs. Limited code reusability. Difficulty in testing & providing mocks.
  • 12. EAA and frameworks Use of Plain-Old-Java-Objects (POJO), Plain-Old-Java-Interfaces (POJI) ● Specification: Java Data Objects (JDO) ● Data Access Objects (DAO) ● Frameworks: iBatis/myBatis, TopLink, jOOQ ● ORM: Hibernate What’s your flavour? Thus, a needed vendor-agnostic standardisation was needed for EAA.
  • 13. Advantages Portability Providing a level of abstraction that is portable across different data stores. Consistent API Standardized API for interacting with DBs can help simplify learning curve for developers & bring uniform coding style. Testability Using POJO, POJI & DI it’s easier to write unit tests for business logic. Separation of concerns Isolation of data access and persistence from the business logic
  • 14. Challenges Performance Overheads Depending on specific implementations and configurations Learning Curve For developers who are new to these concepts. Boilerplate code Implementation of various framework may introduce boilerplate code for CRUD Limited industry adoption Various frameworks took widespread adoptions compared to other frameworks
  • 15. Further Challenges Vendor focused Some queries may result in vendor specific queries. Lack of support for NoSQL DBs Debugging & Profiling Especially with generated SQL queries Tight coupling E.g. change of DB Schema
  • 16. Isolating data from your application 02
  • 17. Purpose To separate the data layer and data access logic from the rest of your application components.
  • 18. Key aspects and principles ● Separation of concerns: Keep data access logic separate from the business logic. ● Testability: Make your data access logic easier to write unit test for your business logic. ● Encapsulation: Hide the details of data storage and retrieval within data access layer. ● Abstraction: Make use of abstract classes and interfaces to define the contract between the data access layer and the rest of the applications. ● Data Access Layer: Encapsulate all interactions with Data Access Logic. ● Interfaces for Data Access: Clean and well-defined contract for data access operations (CRUD). ● Use of Design Pattern: DAO / Repository pattern to structure and isolate data access logic. ● Dependency Injection: Business Logic should depend on Data Access Logic through abstraction. ● ORM: Usage of JPA/Hibernate allows interactions through POJOs, while abstracting database interactions.
  • 19. The Repository pattern Meets all aspects and principles of data isolation: ● Data Access Layer. ● Interfaces for Data Access. ● Use of design pattern (also, caching with strategy pattern?); ● Provides abstraction and loose- coupling between data access and rest of your application.
  • 20. Data Support many data stores Support of DI Relational DBs (JDBC, JPA, Hibernate Session), NoSQL (MongoDB, Redis, Cassandra) Through CDI extensions Query Methods Via @Query or Criteria APIs Repository abstraction Via interfaces: JpaRepository (for JPA), CassandraRepository (Cassandra), etc.
  • 21. Repository Pattern in current Jakarta EE release 03
  • 22. Key aspects Injectable With Jakarta CDI @Inject Testable Either with jUnit, Mockito, Testcontainers, etc. Abstractable Encapsulate Data Access Layer & still integrate with ORM / JPA, JDBC, etc. Repository abstraction Via Repository interface(s)
  • 23. Deltaspike Data Support many data stores Support of DI JPA centric and relational databases. No NoSQL support. Through CDI extensions Query Methods Via @Query module (with JPQL queries) Repository abstraction Via @Repository annotation on repository interface (that extends EntityRepository)
  • 24. Custom approach Best of both Spring Data and Deltaspike Data approach
  • 25. Domain object (I) Entity (I) IdentifiableEntity<ID> (A) JPAEntity<ID> (I) CreatedTimestamp (I) LastModifiedTimestamp (I) SoftDeletedTimestamp
  • 26. Domain Entity Domain objects represent the entities or business objects in the application's domain. The repository is responsible for persisting and retrieving these domain objects. The use of domain objects ensures that the data access layer aligns with the application's business logic.
  • 27.
  • 28. Repository (I) DataRepository<E> (I) CrudRepository<E, ID> (I) SpecificationRepository (I) MicrostreamRepository (I) JPARepository (I) Specification<E> (I) CassandraRepository (A) AbstractJPARepository
  • 29. The repository pattern is the design pattern, used in software development to create an abstraction layer between the application’s business logic and the data access code responsible for interacting with the database or other data sources. Here’s key component we’ve implemented for our Repository Pattern: • Repository interface: At the core of the Repository pattern is the interface that defines a sets of methods for interacting with the data. Each interface abstracts away the data and is defined for the specific domain entity. • Super interface: DataRepository • Sub interface: CrudRepository – Common database operations. Repository key components
  • 30.
  • 31.
  • 32.
  • 33. • Concrete Repository implementation: The repository interface is implemented by a concrete class that provides that actual implementation of that data access logic. This class interacts with the underlying data store to execute the defined operations. Repository key components
  • 34.
  • 35.
  • 36. Making CDI injectable @Repository annotation A CDI Stereotype annotation that makes the class a CDI bean when CDI is available. The repository implementation must be made available via the @jakarta.inject.Inject annotation.
  • 37.
  • 38.
  • 39. 1. Stateless repository: Can inherit state & transactions from business services (EJB 3.x) 2. Reduced boilerplate code: Abstract classes have implemented all common database operations. 3. Entity association: E.g., JPARepository is strongly linked to JPAEntity Other features
  • 40. 1. Repository interface allows us to create mock implementations to be used for testing. 2. Suitable for jUnit, Mockito tests. Testing
  • 42. Jakarta Data Jakarta Data defines core APIs for the Jakarta EE platform allowing applications and other Jakarta EE components to explore the benefits of easy access to data technologies such as relational and non- relational databases, cloud- based data services, and so on.
  • 43. Goals: 1. Increase productivity performing common database operations. 2. Rich Object Mapping integrated. 3. Define Repositories. Still under development: 1. Release will support Jakarta EE 11 2. Specification: https://jakarta.ee/specifications/data/1.0/data- 1.0.0-m1 Jakarta Data 1.0
  • 44. Features: 1. @Repository 2. @Query 3. @Insert, @Update, @Delete 4. @Lifecycle 5. Stateless Repository 6. Built-in interfaces Jakarta Data 1.0
  • 45. Currently: 1. In beta on OpenLiberty Beta (23.0.0.12-beta) 2. Include data-1.0 as feature in server.xml Jakarta Data 1.0
  • 46.
  • 48. Q&A
  • 49. Thank you! Do you have any questions? buhake@gmail.com www.sindi.co.za