TopLink: Now and in the future, O-R Mapping Product of Choice Doug Clarke Principal Product Manager, Oracle9iAS TopLink Oracle Corporation.

Slides:



Advertisements
Similar presentations
Introduction to the Spring Framework
Advertisements

January 30, 2014 Copyright Jim Farley Beyond JDBC: Java Object- Relational Mappings Jim Farley e-Commerce Program Manager GE Research and Development
1 Persistence as an Aspect: TopLink and AOP Shaun Smith Product Manager Jim Clark Solution Architect Merrick Schincariol Senior Engineer.
Copyright ©2010 Oracle Corporation Made available under Creative Commons Attribution-Share Alike 3.0 Unported EclipseLink Runtime Architecture Data Source.
1 Copyright © 2005, Oracle. All rights reserved. Introduction.
Jonathan Maron Principal Product Manager Oracle Corporation.
2 A bank application needs to access information from the customer database and integrate it with loan credit history information stored in a legacy database.
Chapter 10: Designing Databases
Database System Concepts and Architecture
Michael Pizzo Software Architect Data Programmability Microsoft Corporation.
Apache Struts Technology
Spring, Hibernate and Web Services 13 th September 2014.
An architecture for webb applications, J2EE
G O B E Y O N D C O N V E N T I O N WORF: Developing DB2 UDB based Web Services on a Websphere Application Server Kris Van Thillo, ABIS Training & Consulting.
Building Enterprise Applications Using Visual Studio ®.NET Enterprise Architect.
© 2005, Cornell University. Rapid Application Development using the Kuali Architecture (Struts, Spring and OJB) A Case Study Bryan Hutchinson
Pragmatic Application Building: Step by Step Jay Sissom Principal Systems Analyst Indiana University
ORM Object-Relational Mapping 1. Object Persistence Persistence is the ability of an object to survive the lifecycle of the process, in which it resides.
Data Persistence and Object-Relational Mapping Slides by James Brucker, used with his permission 1.
Enterprise Object Framework. What is EOF? Enterprise Objects Framework is a set of tools and resources that help you create applications that work with.
Chapter 10 EJB Concepts of EJB Three Components in Creating an EJB Starting/Stopping J2EE Server and Deployment Tool Installation and Configuration of.
Introduction to the Enterprise Library. Sounds familiar? Writing a component to encapsulate data access Building a component that allows you to log errors.
Hong Kong JUG March 2004 Java Persistence Issues Dennis Leung Oracle Corporation.
1 INTRO TO BUSINESS COMPONENTS FOR JAVA (BC4J) Matt Fierst Computer Resource Team OracleWorld Session
PowerTier EJB in High-Performance Applications John Killoran European Technical Services Manager Persistence Software.
What is Architecture  Architecture is a subjective thing, a shared understanding of a system’s design by the expert developers on a project  In the.
Copyright © 2012 Accenture All Rights Reserved.Copyright © 2012 Accenture All Rights Reserved. Accenture, its logo, and High Performance Delivered are.
Chemical Toxicity and Safety Information System Shuanghui Luo Ying Li Jin Xu.
Enterprise JavaBeans. What is EJB? l An EJB is a specialized, non-visual JavaBean that runs on a server. l EJB technology supports application development.
第十四章 J2EE 入门 Introduction What is J2EE ?
Introduction to Database Management. 1-2 Outline  Database characteristics  DBMS features  Architectures  Organizational roles.
Oracle9i Performance Tuning Chapter 1 Performance Tuning Overview.
Lecturer: Prof. Piero Fraternali, Teaching Assistant: Alessandro Bozzon, Advanced Web Technologies: Struts–
Julie Basu Senior Development Manager Nirav Chanchani Senior Product Manager Oracle Corporation.
Ronnie Saurenmann Principal Architect Microsoft Switzerland.
Source: Peter Eeles, Kelli Houston, and Wojtek Kozaczynsky, Building J2EE Applicationa with the Rational Unified Process, Addison Wesley, 2003 Prepared.
Hibernate Persistence. What is Persistence Persist data to database or other storage.  In OO world, persistence means persist object to external storage.
JBoss at Work Databases and JBoss Chapter 4 Jeff Schmitt October 26, 2006.
INFO1408 Database Design Concepts Week 15: Introduction to Database Management Systems.
® IBM Software Group © 2007 IBM Corporation Best Practices for Session Management
.  A multi layer architecture powered by Spring Framework, ExtJS, Spring Security and Hibernate.  Taken advantage of Spring’s multi layer injection.
Understanding Impact of J2EE On Relational Databases Donald Smith, Technology Director Dennis Leung, VP Engineering Oracle Corporation 40038:
{ Online Dating Popa Adrian Prejbeanu Samir Stefan Andrei Urziceanu Stefanita.
Preface IIntroduction Objectives I-2 Course Overview I-3 1Oracle Application Development Framework Objectives 1-2 J2EE Platform 1-3 Benefits of the J2EE.
1 Copyright © 2004, Oracle. All rights reserved. Oracle Application Development Framework.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Introduction to Data Access with Spring.
Object storage and object interoperability
Introduction to EJB. What is an EJB ?  An enterprise java bean is a server-side component that encapsulates the business logic of an application. By.
Chapter 18 Object Database Management Systems. Outline Motivation for object database management Object-oriented principles Architectures for object database.
Java Programming: Advanced Topics 1 Enterprise JavaBeans Chapter 14.
Introduction – ORM, Helloworld Application
Copyright 2007, Information Builders. Slide 1 iWay Web Services and WebFOCUS Consumption Michael Florkowski Information Builders.
Apache Struts Technology A MVC Framework for Java Web Applications.
Building J2EE Applications Based on Design Patterns with Business Components for Java Olivier LE DIOURIS Principal Product Manager Oracle Corporation.
3 Copyright © 2006, Oracle. All rights reserved. Designing and Developing for Performance.
The Holmes Platform and Applications
J2EE Platform Overview (Application Architecture)
Building Enterprise Applications Using Visual Studio®
New Technology: Why, What ,How
Open Source distributed document DB for an enterprise
The Client/Server Database Environment
POOL persistency framework for LHC
The Client/Server Database Environment
Introduction to J2EE Architecture
Distributed System Using Java 2 Enterprise Edition (J2EE)
Introduction of Week 11 Return assignment 9-1 Collect assignment 10-1
Understanding and Designing with EJB
Developing and testing enterprise Java applications
Object Relational Mapping Tools
Presentation transcript:

TopLink: Now and in the future, O-R Mapping Product of Choice Doug Clarke Principal Product Manager, Oracle9iAS TopLink Oracle Corporation

Speaker’s Qualifications  Doug has a decade of experience in OO Persistence – Development, Consulting & Training  Product Manager for TopLink product

Underestimation Managing persistence related issues is the most underestimated challenge in enterprise Java today – in terms of complexity, effort and maintenance

Agenda  Ways to access RDB from J2EE  Impedance Mismatch  TopLink Overview – TopLink in Development – Runtime Architecture – O-R Mapping Flexibility – Queries – Transactions – Caching – Locking – Performance Features  TopLink Roadmap

J2EE Access of Relational Data  Direct JDBC – Direct SQL calls – Use rows and result sets directly  Persistence Layer – Accessed as objects or components – Transparent that the data is stored in RDB – Persistence layer in middle tier handles object- relational mapping and infrastructure – Required if doing business logic in the middle tier! – Focus of this Session

Direct JDBC  JDBC is NOT a persistence framework – JDBC is a database connection utility – Ok for “Window on data” style application – Ok when business logic is entrenched on database – J2EE becomes a presentation layer… SQLrows JDBC

Object Persistence Layer  Abstracts persistence details from the application layer SQLrows Objects Persistence Layer Objects object-level querying and creation results are objects results are returned as raw data API uses SQL or database specific calls object creation and updates through object-level API J2EE & Web Services JDBC

Problem  Building Java applications with relational databases is a VERY challenging and labor intensive problem to solve – Fundamentally different technology – Different skill sets – Different staff/ownership – Different modeling and design principles Differences must be resolved to fulfill business requirements ?

Impedance Mismatch FactorJ2EERelational Databases Logical View Of Data Objects, methods, inheritance Tables, SQL, stored procedures ScaleHundreds of megabytesGigabytes, terabytes RelationshipsMemory referencesForeign keys UniquenessInternal object idPrimary keys Key SkillsJava development, object modeling SQL, Stored Procedures, data management ToolsIDE, Source code management, Object Modeler, etc Schema designer, query manager, database configuration, etc

Object Level Options  Depends on what component architecture is used: – Entity Beans BMP – Bean Managed Persistence – Entity Beans CMP – Container Managed Persistence – POJO – “Plain Ol’ Java Objects” via Persistence Layer  May be “home-grown” following “DAO” Data Access Object patterns  May use JDO – “Java Data Objects”  May use off the shelf products

J2EE Architectures  J2EE Architecture Options – Servlets – JSP – Session Beans – Message Driven Beans – Web Services  Bottom Line – Java application needs to access relational data somehow…

Oracle9iAS TopLink Solution Oracle9iAS TopLink provides a proven, powerful “out of the box” solution to address the diversity between Java and Databases Oracle9iAS TopLink

TopLink in Development IMPORT GENERATE IMPORT (.class) GENERATE (.java) Java IDE TopLink Meta-Data (XML) Java classes Relational database (schema) TopLink Mapping Workbench

TopLink Runtime Architecture Data Source TopLink Application Application Server Session Data Access Mappings JDBC J2EE Container JTA CMP/ BMP Cache Query TX Entities Java Objects EJB Entity Beans JSP, Servlet, Struts, etc. App Logic

Basic J2EE Persistence Checklist  O-R Mappings  Runtime Components – O-R Mapping Flexibility – Queries – Transactions – Caching – Locking – Performance Features

Data and Object Models  Rich, flexible mapping capabilities provide data and object models a degree of independence  Otherwise, business object model will force changes to the data schema or vice-versa  Often, J2EE component models are nothing more than mirror images of data model or vice versa – NOT desirable

Mapping Tools  The underlying mapping flexibility is very important

Simple Object Model Customer id: int name: String creditRating: int Address id: int city: String zip: String 1:1 Relationship

Typical 1-1 Relationship Schema CUST IDNAME A_ID C_RATING ADDR IDCITYZIP

Other possible Schemas… CUST IDNAMEC_RATE C_ID ADDR IDCITYZIP CUST IDNAMEC_RATING C_ID ADDR IDCITYZIP A_ID CUST_ADDR C_ID CUST IDNAMECITY ZIPC_RATING

Even More Schemas… CUST IDNAME A_ID ADDR IDCITYZIP CUST_CREDIT ID C_RATING CUST IDNAME ADDR IDCITYZIP CUST_CREDIT ID C_RATING A_ID CUST IDNAME ADDR IDCITYZIP CUST_CREDIT ID C_RATING A_ID CC_ID CUST IDNAME CUST_CREDIT IDC_RATING ADDR IDCITYZIPC_ID CUST IDNAME CUST_CREDIT ID C_RATING ADDR IDCITYZIPC_ID

Benefits of Good O-R Mapping  Flexible - Just showed nine valid ways a 1-1 relationship could be represented in a database (Most persistence solutions will only support one)  Without good support, designs will be forced  Comprehensive support for custom types, inheritance,  Simple mapping for identity management  Custom type support  Non-intrusive/transparent to the business model developer

MORE than just Mapping  Querying  Transactions  Caching  Concurrency  Performance

Queries  Java developers are not usually SQL experts – Maintenance and portability become a concern when schema details hard-coded in application  Allow Java based queries that are translated to SQL and leverage database options employee.get(“manager”).get(“address”) = someAddress SELECT * FROM EMP t1, EMP t2, ADDR t3 WHERE t1.MGR_ID = t2.EMP_ID AND t2.ADDR_ID = t3.ADDR_ID AND t3.ADDR_ID = Generates …

Query Features  Ability to trace, profile, and tune SQL  Ad hoc SQL where necessary  Must be able to leverage database abilities – Outer joins – Nested queries – Stored Procedures – Database Specific Optimizations (Oracle Hints)  Choice of query language: SQL, Stored procedures, EJBQL, or TopLink’s Object expressions  In-Memory querying and transaction conformity

Transaction Management  J2EE apps typically support many clients sharing small number of db connections  Ideally would like to minimize length of transaction on database Time Begin Txn Commit Txn Begin Txn Commit Txn

Support for Referential Integrity  Java developers manipulate object model in a manner logical to the business domain  May result in ordering of INSERT, UPDATE and DELETE statements that violate database constraints  Persistence layer should automatically manage this and allow options for Java developer to influence order of statements

Object Cache  Cache your business objects  Improved performance by reducing reads  Configurable  Support for clustered caches  Concurrency support for multi-client reading and writing

Caching in the real world  Any application that caches data, now has to deal with stale data  When and how to refresh?  Will constant refreshing reduce performance?  Problem is compounded in a clustered environment  App server may want be notified of database changes TopLink supports all of these cases

Caching OO Query SQL Query (if desired) Results(s) Does PK for row exist in cache? YES – Get from Cache NO – Build bean/object from results Return object results

Concurrency: Locking  J2EE Developers want to think of locking at the object level  Databases may need to manage locking across many applications  Persistence layer or application server must be able to respect and participate in locks at database level

Optimistic Locking  DBA may wish to use version, timestamp and/or last update field to represent optimistic lock – Java developer may not want this in their business model – Persistence layer must be able to abstract this  Must be able to support using any fields including business domain

Pessimistic Locking  Requires careful attention as a JDBC connection is required for duration of pessimistic lock  Should support SELECT FOR UPDATE [NOWAIT] semantics  Consider Application level pessimistic locking Time Begin Txn Commit Txn Begin Txn Commit Txn Pess Lock

Performance: Lazy Reads  J2EE Applications work on the scale of a few hundreds of megabytes  Relational databases routinely manage gigabytes and terabytes of data  Persistence layer must be able to transparently fetch data “just in time”

Just in Time Reading – Faulting Process Customer Orders Proxy Accessing relationship for first time Get related object based on FK SQL if not cached Check Cache Plug result into Proxy Orders

Object Traversals  Even with lazy reads, object traversal is not always ideal – To find a phone number for the manufacturer of a product that a particular customer bought, may do several queries:  Get customer in question  Get orders for customer  Get parts for order  Get manufacturer for part  Get address for manufacturer – Very natural object traversal results in 5 queries to get data that can be done in 1

N+1 Reads Problem  Many persistence layers and application servers have an N+1 reads problem  Causes N subsequent queries to fetch related data when a collection is queried for  A side effect of the impedance mismatch and poor mapping and querying support in persistence layers

N+1 Reads Problem Pool of Created Objects or Beans Persistence Layer or EJB Container findByCity() 1 2 For each Customer Fetch their Address Address n Returns collection n If Address had related objects, they too may be fetched 2n+1 Reads! Container returns results C C CC

N+1 Reads  Must have solution to minimize queries  Need flexibility to reduce to 1 query, 1+1 query or N+1 query where appropriate – 1 Query when displaying list of customers and addresses – known as a “Join Read” – 1+1 Query when displaying list of customers and user may click button to see addresses – known as a “Batch Read” – N+1 Query when displaying list of customers but only want to see address for selected customer

Performance and Tuning Options  Minimal Writes, Updates  Batch Reading, Writing  SQL ordering  Transformation support  Existence checks  Stored procedures  Read Lock Support  Statement Caching  Scrolling cursors  Partial Attribute Queries  “Just in Time” reading AND MUCH MORE!  Automatic change detection  Caching policies and sizes  Parameterized SQL  Pre-allocation of sequence numbers  Cache synchronization support  Optimistic, Pessimistic locking  Joining object retrieval optimization  In memory querying  Dynamic queries  Query optimization

Why is TopLink the O-R leader?  Productive development tools  Extremely flexible O-R mappings  Choice and performance in querying  Scalable cache and transaction framework  Powerful performance tuning options  Strong J2EE support and integrations  Complete architecture and database flexibility Award winning product based on years of real world application development and backed by world’s leading enterprise software company.

What’s Next: TopLink Roadmap  Maintain leadership in O-R persistence  Expand data source support: – EIS through J2EE Connector Architecture – Object-to-XML  Maintain current with standards and provide functionality demanded by our customers

TopLink & XML  XML documents can be represented at different levels of abstractions in J2EE applications: – Parsed document (DOM, SAX …) - parser – Unmanaged Java objects from non-transactional data source – data converter – Managed Java objects from a transactional data source – persistence manager

3 Levels of XML Representation XML Parser O-X Data Converter XML Document Unmanaged Object Persistence Manager XDBEIS JDBCJ2C DOM Managed Object/EJB File Web Service BPMJMS

Impact on J2EE Integration Solutions  This technology will be critical for many J2EE applications accessing EIS systems via JCA resource adapters – XML based adapters will outgrow proprietary data formats – “80% of the worldwide data resides on mainframes.” Gartner  Without it, developers will have to work with low level XML documents and manually code persistence manager functionality

Benefits of XML/JCA Support  Easier to adopt and integrate web services, disparate data and legacy applications.  Abstracting data details provides flexibility and portability.  Increased developer productivity as they focus on building applications not infrastructure.  Single abstraction layer to access heterogeneous data sources.  Optimized performance and scalability.  Leverage existing architecture and developer skills base

Summary  TopLink is clearly leader in O-R mapping  Many exciting directions for the future

If You Only Remember One Thing… When choosing a persistence layer, Pick one that maximizes your flexibility across all the issues outlined here today!

A Q & Q U E S T I O N S A N S W E R S