SlideShare a Scribd company logo
1 of 36
Download to read offline
EclipseLink JPA
in GlassFish™
Doug Clarke
Director of Product Management
Oracle
Eclipse Persistence Services
“EclipseLink”

  Java SE   Java EE        OSGi          Spring       ADF




      JPA    MOXy           EIS           SDO        DBWS




            Eclipse Persistence Services Project
                       (EclipseLink)




Databases              XML Data                    Legacy Systems
History of EclipseLink




                            TopLink
                           Essentials




1996                                    2008
Significance of EclipseLink

• First comprehensive open source persistence solution
   • Object-Relational and much more
• Based upon product with 12 years of commercial
  usage
• Shared infrastructure
  • Easily share the same domain model with multiple
    persistence technologies
  • Leverage metadata for multiple services
• Important part of the GlassFish and Eclipse
 Ecosystems
EclipseLink JPA

• JPA 1.0 compliant implementation
• Java EE, Java SE, Web, Spring, and OSGi
• Any JDBC/SQL compliant database
   • Advanced database extensions: stored procedures, native SQL, …
• Key infrastructure:
   •   Caching, Locking, Query Framework, Mapping, …
   •   JDBC connection pooling
   •   Diagnostics: Logging, Profiling
   •   DDL Generation
   •   Customization callbacks
• Highly Extensible
• … plus many valuable advanced features
Caching

• Hold objects in-memory to avoid unnecessary
    database trips and object construction
•   Cache manages “identity” to support bidirectional and
    cyclical relationships
•   Flexible caching options ensure that you get
    maximum performance
•   Numerous locking, refreshing, and synchronization
    options are available to minimize cache staleness
•   Queries can be run in-memory only against the cache
•   Cache Coordination supports clustering
Cache Configuration

• Cache Shared (L2)/Isolated (L1 only)
   • Entity cache—not data cache
• <property
      name=“eclipselink.cache.shared.default“
      value=quot;truequot;/>
• Cache Type & Size
   • Soft/Hard Weak       @Cache(type = CacheType.HARD_WEAK,
                                 size = 500,
   • Weak                        isolated = true,
   • Full                        coordinationType =
   • None                        INVALIDATE_CHANGED_OBJECTS)
• <property
      name=“eclipselink.cache.type.default“
      value=quot;Fullquot;/>
EclipseLink JPA Caching




EntityManager   EntityManagerFactory

  L1 Cache            L2 Cache
                      (Shared )

                                       Cache Coordination
Minimize stale cache

• Configure the cache relative to application data’s
 usage
  • Is the data shared between users/processes?
  • Is the data volatile?
     • Only through JPA application?
     • Through direct DB modification?
• Ensure you protect any data that can be concurrently
 modified with a locking strategy
  • Must handle optimistic lock failures on flush/commit
• Use query refreshing to minimize optimistic lock
 failures
Leveraging the Shared Cache: Reading
        Client-1                                Client-2
           1                                      5

    EntityManager-1                   EntityManager-2

L1 Cache                       L1 Cache



           2                                      6
                                                           3
EntityManagerFactory
L2 Cache                Connection Pool                    7
                                   Connection
                                 Connection
                       4 8      Connection
                               Connection
                             Connection
Leveraging the Shared Cache: Writing
                                              Client-2
                                                1

                                    EntityManager-2

                             L1 Cache




                                                2

EntityManagerFactory                                     3
L2 Cache               Connection Pool
                                 Connection
                       4       Connection
                              Connection
                             Connection
                           Connection
Leveraging the Shared Cache: Writing




EntityManagerFactory
L2 Cache               Connection Pool
                               Connection
                             Connection
                            Connection
                           Connection
                         Connection
Advanced Mappings

• @Converter
• @BasicMap and @BasicCollection
• Mapping to database structures
  • @StructConverter – Structs, ADTs
  • XML types, PL/SQL Records
• Mapping features
  • Private Owned
  • Join/Batch Fetch
  • Returning
Advanced Mapping Example


@Entity
@Cache(type=SOFT_WEAK, coordinationType=SEND_OBJECT_CHANGES)
@Converter(name=“money”, converterClass=MoneyConverter.class)
@OptimisticLocking(type=CHANGED_COLUMNS)
public class Employee {
  @Id
  private int id;

    private String name;

    @OneToMany(mappedBy=“owner”)
    private List<PhoneNumbers> phones;
    @Convert(“money”)
    private Money salary
    …
}
Advanced Querying

• Support for supplying customizing queries
   • Native SQL
   • @NamedStoredProcQuery
• Graph Loading Optimizations
  • Join and Batch Fetch – multi-level
• Cache Usage: In-memory
• Result caching
Transactions

• Java apps typically support many clients sharing
  small number of db connections
• Ideally would like to minimize length of transaction on
  database



            Begin Txn
     Time




                                    Begin Txn
            Commit Txn
                                    Commit Txn
Transaction Features

• Minimizes database interactions
  • Only the minimal updates are sent to the database
• Respect database integrity
   • Orders INSERT, UPDATE and DELETE statements
• JTA and RESOURCE_LOCAL support
• Attribute-level change tracking
• EntityManager flush SQL prior to commit
• Bulk Update and Delete
   • Cached entities effected
Concurrency Protection - Locking

• Optimistic concurrency included in JPA 1.0, but no
  support for pessimistic locking is specified
• EclipseLink has advanced optimistic locking
  strategies
  • Numeric, Timestamp, All fields, Selected fields, Changed field
• EntityManager lock() method can be used with
  optimistic locking, and error handling
• EclipseLink supports pessimistic locking through
  query hints

   query.setHint(PESSIMISTIC_LOCK, LockNoWait);
Weaving

• EclipseLink makes use of Weaving (ASM) to
 introduce additional functionality into the JPA entity
 classes
  • Needed for M:1 and 1:1 lazy fetching
  • Integrated with Java EE compliant App Servers and Spring
    2.0
  • Available for Java SE using JDK/JRE’s –javaagent:
  • Optional
  • Static weaving also supported
     • Weaving of .class files before deployment
JPA Configuration Options

• Annotations
   • JPA
   • EclipseLink
• ORM.XML
  • JPA
  • EclipseLink
  • JPA + EclipseLink
• Defaults – Configuration by Exception
Database Platform

XML:
<properties>
<property
     name=“eclipselink.target-databasequot;
      value=quot;Derbyquot;/>
</properties>

API:
 properties.put(
  EclipseLinkProperties.TARGET_DATABASE,
  TargetDatabase.ORACLE);
Target Database Platform

• TargetDatabase (org.eclipse.persistence.jpa.config)
   • Auto (Default)
   • Oracle, Oracle8i, Oracle9i, Oracle10g, Oracle11, TimesTen
   • DB2, DB2Mainframe
   • Derby, JavaDB, MySQL
   • Informix
   • HSQL, PointBase
   • PostgreSQL
   • SQLAnyWhere
   • SQLServer, DBase
   • Sybase
Server Platform

• Enables simplified configuration of the target
  application server
• Used to enable integration with:
  • JTA transaction manager
  • Logging
  • JDBC connection un-wrapping

• <property name=“eclipselink.target-serverquot;
   value=“SunAS9quot;/>
Target Server Options

• TargetServer (org.eclipse.persistence.jpa.config)
   • None (Default)
   • OC4J, OC4J_10_1_3, OC4J_11_1_1
   • SunAS9
   • WebSphere
   • WebSphere_6_1
   • WebLogic, WebLogic_9, WebLogic_10
   • JBoss
JDBC Connection Settings

<properties>
...
<property name=“eclipselink.jdbc.driver”
  value=“oracle.jdbc.Driver”/>

<property name=“eclipselink.jdbc.url”
  value=“jdbc:oracle:thin:@localhost:1521:XE”/>

<property name=“eclipselink.jdbc.user” value=“scott”/>

<property name=“eclipselink.jdbc.password”
  value=“tiger”/>
Logging

<properties>
  ...

 <property
     name=“eclipselink.logging.levelquot;
     value=quot;FINEquot;/>
 ...

</properties>
DDL Generation

• Standard enables it but does not currently dictate that
  providers support it
• Mapping metadata specifies how DDL should be
  generated
• Vendors may offer differing levels of support,
  including:
  • Generating DDL to a file only
  • Generating and executing DDL in DB
  • Dropping existing tables before creating new ones
DDL Generation

<properties>
  ...
  <property
      name=“eclipselink.ddl-generationquot;
      value=quot;create-tablesquot;/>
  ...
</properties>
Customization Using Properties

<properties>
  ...
 <property
    name=quot;eclipselink.session.customizerquot;
    value=quot;acme.MySessionCustomizerquot;/>
  <property

 name=quot;eclipselink.descriptor.customizer.Employe
 equot;
    value=quot;acme.MyDescriptorCustomizerquot;/>
  ...
</properties>
Descriptor & Session Customizers


public class MySessionCustomizer
                implements SessionCustomizer {

    public void customize(Session session) {
       session.setProfiler(new PerformanceProfiler());
    }
}

public class MyDescriptorCustomizer
                implements DescriptorCustomizer {

    public void customize(ClassDescriptor desc) {
      desc.disableCacheHits();
    }
}
Performance and Tuning

• Highly configurable and tunable
   • Guiding principle – minimize and optimize database
     interactions
   • No two applications are the same, EclipseLink allows for
     decisions on what specific behavior needs to be configurable
     depending on situation
• Flexibility of EclipseLink allows efficient business
  models and relational schemas to be used
• Leverages underlying performance tuning features
  •   Java, JDBC and the underlying database technology
  •   Batch Writing
  •   Parameter Binding
  •   Statement Caching
Performance and Tuning


    Minimal Writes, Updates     
                                 “Just in Time” reading

    Batch Reading, Writing      
                                 Automatic change detection

    SQL ordering                
                                 Caching policies and sizes

    Transformation support      
                                 Parameterized SQL (binding)

    Existence checks            
                                 Pre-allocation of sequence

    Stored procedures           numbers

    Statement Caching           
                                 Cache Coordination

    Scrolling cursors           
                                 Optimistic, Pessimistic locking

    Projection Queries          
                                 Joining object retrieval

    Partial Attribute Queries   optimization
                                
                                 In memory querying
                                
                                 Dynamic queries

                 AND MUCH MORE!
EclipseLink Status

• Incubating Technology Project
  •   Initial contribution of Oracle TopLink complete
  •   Full documentation available on Wiki
  •   Producing Monthly Milestone builds
  •   Milestones included in GlassFish V3 Milestones
• 1.0 release planned for July 2008
  • JPA 1.0, SDO 2.1, JAXB
  • Simplified XML and annotation config of advanced features
  • Packaged for Java SE/EE and OSGi bundles
• Beyond 1.0
  •   JPA 2.0 (Reference Implementation)
  •   Database Web Services
  •   Data Access Service (DAS) 1.0
  •   and much more …
Getting Started with EclipseLink JPA


• EclipseLink Project
 http://www.eclipse.org/eclipselink
 Eclipse newsgroup: eclipse.technology.eclipselink

• GlassFish V3
 https://glassfish.dev.java.net/

• Open Source JPA Tools
  • NetBeans—http://www.netbeans.org

  • Dali JPA Tools—http://www.eclipse.org/dali
Orcale Presentation

More Related Content

What's hot

GlassFish REST Administration Backend
GlassFish REST Administration BackendGlassFish REST Administration Backend
GlassFish REST Administration BackendArun Gupta
 
AAI 1713-Introduction to Java EE 7
AAI 1713-Introduction to Java EE 7AAI 1713-Introduction to Java EE 7
AAI 1713-Introduction to Java EE 7Kevin Sutter
 
Weblogic server administration
Weblogic server administrationWeblogic server administration
Weblogic server administrationbispsolutions
 
Lecture 2: Servlets
Lecture 2:  ServletsLecture 2:  Servlets
Lecture 2: ServletsFahad Golra
 
Weblogic 11g admin basic with screencast
Weblogic 11g admin basic with screencastWeblogic 11g admin basic with screencast
Weblogic 11g admin basic with screencastRajiv Gupta
 
Weblogic Server
Weblogic ServerWeblogic Server
Weblogic Serveracsvianabr
 
Shopzilla On Concurrency
Shopzilla On ConcurrencyShopzilla On Concurrency
Shopzilla On ConcurrencyRodney Barlow
 
The Java EE 7 Platform: Productivity++ & Embracing HTML5
The Java EE 7 Platform: Productivity++ & Embracing HTML5The Java EE 7 Platform: Productivity++ & Embracing HTML5
The Java EE 7 Platform: Productivity++ & Embracing HTML5Arun Gupta
 
JPA and Coherence with TopLink Grid
JPA and Coherence with TopLink GridJPA and Coherence with TopLink Grid
JPA and Coherence with TopLink GridJames Bayer
 
Running your Java EE 6 applications in the Cloud
Running your Java EE 6 applications in the CloudRunning your Java EE 6 applications in the Cloud
Running your Java EE 6 applications in the CloudArun Gupta
 
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012Arun Gupta
 
GlassFish & Java EE Business Update @ CEJUG
GlassFish & Java EE Business Update @ CEJUGGlassFish & Java EE Business Update @ CEJUG
GlassFish & Java EE Business Update @ CEJUGArun Gupta
 

What's hot (20)

Java EE 8
Java EE 8Java EE 8
Java EE 8
 
Servlet programming
Servlet programmingServlet programming
Servlet programming
 
WebLogic for DBAs
WebLogic for DBAsWebLogic for DBAs
WebLogic for DBAs
 
Hadoop 101
Hadoop 101Hadoop 101
Hadoop 101
 
GlassFish REST Administration Backend
GlassFish REST Administration BackendGlassFish REST Administration Backend
GlassFish REST Administration Backend
 
Jdbc
JdbcJdbc
Jdbc
 
AAI 1713-Introduction to Java EE 7
AAI 1713-Introduction to Java EE 7AAI 1713-Introduction to Java EE 7
AAI 1713-Introduction to Java EE 7
 
Weblogic server administration
Weblogic server administrationWeblogic server administration
Weblogic server administration
 
Lecture 2: Servlets
Lecture 2:  ServletsLecture 2:  Servlets
Lecture 2: Servlets
 
Java EE 7 overview
Java EE 7 overviewJava EE 7 overview
Java EE 7 overview
 
Weblogic 11g admin basic with screencast
Weblogic 11g admin basic with screencastWeblogic 11g admin basic with screencast
Weblogic 11g admin basic with screencast
 
Weblogic Server
Weblogic ServerWeblogic Server
Weblogic Server
 
Shopzilla On Concurrency
Shopzilla On ConcurrencyShopzilla On Concurrency
Shopzilla On Concurrency
 
The Java EE 7 Platform: Productivity++ & Embracing HTML5
The Java EE 7 Platform: Productivity++ & Embracing HTML5The Java EE 7 Platform: Productivity++ & Embracing HTML5
The Java EE 7 Platform: Productivity++ & Embracing HTML5
 
JPA and Coherence with TopLink Grid
JPA and Coherence with TopLink GridJPA and Coherence with TopLink Grid
JPA and Coherence with TopLink Grid
 
Running your Java EE 6 applications in the Cloud
Running your Java EE 6 applications in the CloudRunning your Java EE 6 applications in the Cloud
Running your Java EE 6 applications in the Cloud
 
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012
 
GlassFish & Java EE Business Update @ CEJUG
GlassFish & Java EE Business Update @ CEJUGGlassFish & Java EE Business Update @ CEJUG
GlassFish & Java EE Business Update @ CEJUG
 
Basi Dati F2
Basi Dati F2Basi Dati F2
Basi Dati F2
 
Jdbc introduction
Jdbc introductionJdbc introduction
Jdbc introduction
 

Similar to Orcale Presentation

Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Arun Gupta
 
Solving the C20K problem: Raising the bar in PHP Performance and Scalability
Solving the C20K problem: Raising the bar in PHP Performance and ScalabilitySolving the C20K problem: Raising the bar in PHP Performance and Scalability
Solving the C20K problem: Raising the bar in PHP Performance and ScalabilityZendCon
 
Application Architecture Trends
Application Architecture TrendsApplication Architecture Trends
Application Architecture TrendsSrini Penchikala
 
GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012Arun Gupta
 
OOW09 Ebs Tuning Final
OOW09 Ebs Tuning FinalOOW09 Ebs Tuning Final
OOW09 Ebs Tuning Finaljucaab
 
Centralized logging for (java) applications with the elastic stack made easy
Centralized logging for (java) applications with the elastic stack   made easyCentralized logging for (java) applications with the elastic stack   made easy
Centralized logging for (java) applications with the elastic stack made easyfelixbarny
 
Running your Java EE applications in the Cloud
Running your Java EE applications in the CloudRunning your Java EE applications in the Cloud
Running your Java EE applications in the CloudArun Gupta
 
Technic4
Technic4Technic4
Technic4hjue
 
WebLogic Developer Webcast 1: JPA 2.0
WebLogic Developer Webcast 1: JPA 2.0WebLogic Developer Webcast 1: JPA 2.0
WebLogic Developer Webcast 1: JPA 2.0Jeffrey West
 
Oracle WebLogic 12c New Multitenancy features
Oracle WebLogic 12c New Multitenancy featuresOracle WebLogic 12c New Multitenancy features
Oracle WebLogic 12c New Multitenancy featuresMichel Schildmeijer
 
X Aware Ajax World V1
X Aware Ajax World V1X Aware Ajax World V1
X Aware Ajax World V1rajivmordani
 
Running your Java EE 6 applications in the Cloud @ Silicon Valley Code Camp 2010
Running your Java EE 6 applications in the Cloud @ Silicon Valley Code Camp 2010Running your Java EE 6 applications in the Cloud @ Silicon Valley Code Camp 2010
Running your Java EE 6 applications in the Cloud @ Silicon Valley Code Camp 2010Arun Gupta
 
New Features of Java7 SE
New Features of Java7 SENew Features of Java7 SE
New Features of Java7 SEdogangoko
 
Haj 4308-open jpa, eclipselink, and the migration toolkit
Haj 4308-open jpa, eclipselink, and the migration toolkitHaj 4308-open jpa, eclipselink, and the migration toolkit
Haj 4308-open jpa, eclipselink, and the migration toolkitKevin Sutter
 
The Very Very Latest in Database Development - Oracle Open World 2012
The Very Very Latest in Database Development - Oracle Open World 2012The Very Very Latest in Database Development - Oracle Open World 2012
The Very Very Latest in Database Development - Oracle Open World 2012Lucas Jellema
 
Introduction to Web Application Clustering
Introduction to Web Application ClusteringIntroduction to Web Application Clustering
Introduction to Web Application ClusteringPiyush Katariya
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroOndrej Mihályi
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroPayara
 

Similar to Orcale Presentation (20)

EclipseLink JPA
EclipseLink JPAEclipseLink JPA
EclipseLink JPA
 
Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011
 
Solving the C20K problem: Raising the bar in PHP Performance and Scalability
Solving the C20K problem: Raising the bar in PHP Performance and ScalabilitySolving the C20K problem: Raising the bar in PHP Performance and Scalability
Solving the C20K problem: Raising the bar in PHP Performance and Scalability
 
Application Architecture Trends
Application Architecture TrendsApplication Architecture Trends
Application Architecture Trends
 
GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012
 
OOW09 Ebs Tuning Final
OOW09 Ebs Tuning FinalOOW09 Ebs Tuning Final
OOW09 Ebs Tuning Final
 
Centralized logging for (java) applications with the elastic stack made easy
Centralized logging for (java) applications with the elastic stack   made easyCentralized logging for (java) applications with the elastic stack   made easy
Centralized logging for (java) applications with the elastic stack made easy
 
Running your Java EE applications in the Cloud
Running your Java EE applications in the CloudRunning your Java EE applications in the Cloud
Running your Java EE applications in the Cloud
 
Technic4
Technic4Technic4
Technic4
 
WebLogic Developer Webcast 1: JPA 2.0
WebLogic Developer Webcast 1: JPA 2.0WebLogic Developer Webcast 1: JPA 2.0
WebLogic Developer Webcast 1: JPA 2.0
 
Oracle WebLogic 12c New Multitenancy features
Oracle WebLogic 12c New Multitenancy featuresOracle WebLogic 12c New Multitenancy features
Oracle WebLogic 12c New Multitenancy features
 
X Aware Ajax World V1
X Aware Ajax World V1X Aware Ajax World V1
X Aware Ajax World V1
 
Running your Java EE 6 applications in the Cloud @ Silicon Valley Code Camp 2010
Running your Java EE 6 applications in the Cloud @ Silicon Valley Code Camp 2010Running your Java EE 6 applications in the Cloud @ Silicon Valley Code Camp 2010
Running your Java EE 6 applications in the Cloud @ Silicon Valley Code Camp 2010
 
New Features of Java7 SE
New Features of Java7 SENew Features of Java7 SE
New Features of Java7 SE
 
Haj 4308-open jpa, eclipselink, and the migration toolkit
Haj 4308-open jpa, eclipselink, and the migration toolkitHaj 4308-open jpa, eclipselink, and the migration toolkit
Haj 4308-open jpa, eclipselink, and the migration toolkit
 
The Very Very Latest in Database Development - Oracle Open World 2012
The Very Very Latest in Database Development - Oracle Open World 2012The Very Very Latest in Database Development - Oracle Open World 2012
The Very Very Latest in Database Development - Oracle Open World 2012
 
The Very Very Latest In Database Development - Lucas Jellema - Oracle OpenWor...
The Very Very Latest In Database Development - Lucas Jellema - Oracle OpenWor...The Very Very Latest In Database Development - Lucas Jellema - Oracle OpenWor...
The Very Very Latest In Database Development - Lucas Jellema - Oracle OpenWor...
 
Introduction to Web Application Clustering
Introduction to Web Application ClusteringIntroduction to Web Application Clustering
Introduction to Web Application Clustering
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara Micro
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara Micro
 

More from Sanjeev Kulkarni

Jfreereport and Charts an essential Report generation tool for Java Developers
Jfreereport and Charts an essential Report generation tool for Java DevelopersJfreereport and Charts an essential Report generation tool for Java Developers
Jfreereport and Charts an essential Report generation tool for Java DevelopersSanjeev Kulkarni
 
H2 Database New generation embeded database
H2 Database New generation embeded databaseH2 Database New generation embeded database
H2 Database New generation embeded databaseSanjeev Kulkarni
 

More from Sanjeev Kulkarni (7)

Gooogle Web Toolkit
Gooogle Web ToolkitGooogle Web Toolkit
Gooogle Web Toolkit
 
Jfreereport and Charts an essential Report generation tool for Java Developers
Jfreereport and Charts an essential Report generation tool for Java DevelopersJfreereport and Charts an essential Report generation tool for Java Developers
Jfreereport and Charts an essential Report generation tool for Java Developers
 
H2 Database New generation embeded database
H2 Database New generation embeded databaseH2 Database New generation embeded database
H2 Database New generation embeded database
 
Only In India
Only In IndiaOnly In India
Only In India
 
The Woman
The Woman The Woman
The Woman
 
Sweet Girl...
Sweet Girl...Sweet Girl...
Sweet Girl...
 
What is meant by Love???
What is meant by Love???What is meant by Love???
What is meant by Love???
 

Recently uploaded

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

Orcale Presentation

  • 1.
  • 2. EclipseLink JPA in GlassFish™ Doug Clarke Director of Product Management Oracle
  • 3. Eclipse Persistence Services “EclipseLink” Java SE Java EE OSGi Spring ADF JPA MOXy EIS SDO DBWS Eclipse Persistence Services Project (EclipseLink) Databases XML Data Legacy Systems
  • 4. History of EclipseLink TopLink Essentials 1996 2008
  • 5. Significance of EclipseLink • First comprehensive open source persistence solution • Object-Relational and much more • Based upon product with 12 years of commercial usage • Shared infrastructure • Easily share the same domain model with multiple persistence technologies • Leverage metadata for multiple services • Important part of the GlassFish and Eclipse Ecosystems
  • 6. EclipseLink JPA • JPA 1.0 compliant implementation • Java EE, Java SE, Web, Spring, and OSGi • Any JDBC/SQL compliant database • Advanced database extensions: stored procedures, native SQL, … • Key infrastructure: • Caching, Locking, Query Framework, Mapping, … • JDBC connection pooling • Diagnostics: Logging, Profiling • DDL Generation • Customization callbacks • Highly Extensible • … plus many valuable advanced features
  • 7. Caching • Hold objects in-memory to avoid unnecessary database trips and object construction • Cache manages “identity” to support bidirectional and cyclical relationships • Flexible caching options ensure that you get maximum performance • Numerous locking, refreshing, and synchronization options are available to minimize cache staleness • Queries can be run in-memory only against the cache • Cache Coordination supports clustering
  • 8. Cache Configuration • Cache Shared (L2)/Isolated (L1 only) • Entity cache—not data cache • <property name=“eclipselink.cache.shared.default“ value=quot;truequot;/> • Cache Type & Size • Soft/Hard Weak @Cache(type = CacheType.HARD_WEAK, size = 500, • Weak isolated = true, • Full coordinationType = • None INVALIDATE_CHANGED_OBJECTS) • <property name=“eclipselink.cache.type.default“ value=quot;Fullquot;/>
  • 9. EclipseLink JPA Caching EntityManager EntityManagerFactory L1 Cache L2 Cache (Shared ) Cache Coordination
  • 10. Minimize stale cache • Configure the cache relative to application data’s usage • Is the data shared between users/processes? • Is the data volatile? • Only through JPA application? • Through direct DB modification? • Ensure you protect any data that can be concurrently modified with a locking strategy • Must handle optimistic lock failures on flush/commit • Use query refreshing to minimize optimistic lock failures
  • 11. Leveraging the Shared Cache: Reading Client-1 Client-2 1 5 EntityManager-1 EntityManager-2 L1 Cache L1 Cache 2 6 3 EntityManagerFactory L2 Cache Connection Pool 7 Connection Connection 4 8 Connection Connection Connection
  • 12. Leveraging the Shared Cache: Writing Client-2 1 EntityManager-2 L1 Cache 2 EntityManagerFactory 3 L2 Cache Connection Pool Connection 4 Connection Connection Connection Connection
  • 13. Leveraging the Shared Cache: Writing EntityManagerFactory L2 Cache Connection Pool Connection Connection Connection Connection Connection
  • 14. Advanced Mappings • @Converter • @BasicMap and @BasicCollection • Mapping to database structures • @StructConverter – Structs, ADTs • XML types, PL/SQL Records • Mapping features • Private Owned • Join/Batch Fetch • Returning
  • 15. Advanced Mapping Example @Entity @Cache(type=SOFT_WEAK, coordinationType=SEND_OBJECT_CHANGES) @Converter(name=“money”, converterClass=MoneyConverter.class) @OptimisticLocking(type=CHANGED_COLUMNS) public class Employee { @Id private int id; private String name; @OneToMany(mappedBy=“owner”) private List<PhoneNumbers> phones; @Convert(“money”) private Money salary … }
  • 16. Advanced Querying • Support for supplying customizing queries • Native SQL • @NamedStoredProcQuery • Graph Loading Optimizations • Join and Batch Fetch – multi-level • Cache Usage: In-memory • Result caching
  • 17. Transactions • Java apps typically support many clients sharing small number of db connections • Ideally would like to minimize length of transaction on database Begin Txn Time Begin Txn Commit Txn Commit Txn
  • 18. Transaction Features • Minimizes database interactions • Only the minimal updates are sent to the database • Respect database integrity • Orders INSERT, UPDATE and DELETE statements • JTA and RESOURCE_LOCAL support • Attribute-level change tracking • EntityManager flush SQL prior to commit • Bulk Update and Delete • Cached entities effected
  • 19. Concurrency Protection - Locking • Optimistic concurrency included in JPA 1.0, but no support for pessimistic locking is specified • EclipseLink has advanced optimistic locking strategies • Numeric, Timestamp, All fields, Selected fields, Changed field • EntityManager lock() method can be used with optimistic locking, and error handling • EclipseLink supports pessimistic locking through query hints query.setHint(PESSIMISTIC_LOCK, LockNoWait);
  • 20. Weaving • EclipseLink makes use of Weaving (ASM) to introduce additional functionality into the JPA entity classes • Needed for M:1 and 1:1 lazy fetching • Integrated with Java EE compliant App Servers and Spring 2.0 • Available for Java SE using JDK/JRE’s –javaagent: • Optional • Static weaving also supported • Weaving of .class files before deployment
  • 21. JPA Configuration Options • Annotations • JPA • EclipseLink • ORM.XML • JPA • EclipseLink • JPA + EclipseLink • Defaults – Configuration by Exception
  • 22. Database Platform XML: <properties> <property name=“eclipselink.target-databasequot; value=quot;Derbyquot;/> </properties> API: properties.put( EclipseLinkProperties.TARGET_DATABASE, TargetDatabase.ORACLE);
  • 23. Target Database Platform • TargetDatabase (org.eclipse.persistence.jpa.config) • Auto (Default) • Oracle, Oracle8i, Oracle9i, Oracle10g, Oracle11, TimesTen • DB2, DB2Mainframe • Derby, JavaDB, MySQL • Informix • HSQL, PointBase • PostgreSQL • SQLAnyWhere • SQLServer, DBase • Sybase
  • 24. Server Platform • Enables simplified configuration of the target application server • Used to enable integration with: • JTA transaction manager • Logging • JDBC connection un-wrapping • <property name=“eclipselink.target-serverquot; value=“SunAS9quot;/>
  • 25. Target Server Options • TargetServer (org.eclipse.persistence.jpa.config) • None (Default) • OC4J, OC4J_10_1_3, OC4J_11_1_1 • SunAS9 • WebSphere • WebSphere_6_1 • WebLogic, WebLogic_9, WebLogic_10 • JBoss
  • 26. JDBC Connection Settings <properties> ... <property name=“eclipselink.jdbc.driver” value=“oracle.jdbc.Driver”/> <property name=“eclipselink.jdbc.url” value=“jdbc:oracle:thin:@localhost:1521:XE”/> <property name=“eclipselink.jdbc.user” value=“scott”/> <property name=“eclipselink.jdbc.password” value=“tiger”/>
  • 27. Logging <properties> ... <property name=“eclipselink.logging.levelquot; value=quot;FINEquot;/> ... </properties>
  • 28. DDL Generation • Standard enables it but does not currently dictate that providers support it • Mapping metadata specifies how DDL should be generated • Vendors may offer differing levels of support, including: • Generating DDL to a file only • Generating and executing DDL in DB • Dropping existing tables before creating new ones
  • 29. DDL Generation <properties> ... <property name=“eclipselink.ddl-generationquot; value=quot;create-tablesquot;/> ... </properties>
  • 30. Customization Using Properties <properties> ... <property name=quot;eclipselink.session.customizerquot; value=quot;acme.MySessionCustomizerquot;/> <property name=quot;eclipselink.descriptor.customizer.Employe equot; value=quot;acme.MyDescriptorCustomizerquot;/> ... </properties>
  • 31. Descriptor & Session Customizers public class MySessionCustomizer implements SessionCustomizer { public void customize(Session session) { session.setProfiler(new PerformanceProfiler()); } } public class MyDescriptorCustomizer implements DescriptorCustomizer { public void customize(ClassDescriptor desc) { desc.disableCacheHits(); } }
  • 32. Performance and Tuning • Highly configurable and tunable • Guiding principle – minimize and optimize database interactions • No two applications are the same, EclipseLink allows for decisions on what specific behavior needs to be configurable depending on situation • Flexibility of EclipseLink allows efficient business models and relational schemas to be used • Leverages underlying performance tuning features • Java, JDBC and the underlying database technology • Batch Writing • Parameter Binding • Statement Caching
  • 33. Performance and Tuning  Minimal Writes, Updates  “Just in Time” reading  Batch Reading, Writing  Automatic change detection  SQL ordering  Caching policies and sizes  Transformation support  Parameterized SQL (binding)  Existence checks  Pre-allocation of sequence  Stored procedures numbers  Statement Caching  Cache Coordination  Scrolling cursors  Optimistic, Pessimistic locking  Projection Queries  Joining object retrieval  Partial Attribute Queries optimization  In memory querying  Dynamic queries AND MUCH MORE!
  • 34. EclipseLink Status • Incubating Technology Project • Initial contribution of Oracle TopLink complete • Full documentation available on Wiki • Producing Monthly Milestone builds • Milestones included in GlassFish V3 Milestones • 1.0 release planned for July 2008 • JPA 1.0, SDO 2.1, JAXB • Simplified XML and annotation config of advanced features • Packaged for Java SE/EE and OSGi bundles • Beyond 1.0 • JPA 2.0 (Reference Implementation) • Database Web Services • Data Access Service (DAS) 1.0 • and much more …
  • 35. Getting Started with EclipseLink JPA • EclipseLink Project http://www.eclipse.org/eclipselink Eclipse newsgroup: eclipse.technology.eclipselink • GlassFish V3 https://glassfish.dev.java.net/ • Open Source JPA Tools • NetBeans—http://www.netbeans.org • Dali JPA Tools—http://www.eclipse.org/dali