WebLogic Developer Webcast 1: JPA 2.0

1,682 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,682
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
35
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • This is our standard disclaimer--we will touch on some visionary things in this talk that should not be used for contractual purposes.
  • WebLogic Developer Webcast 1: JPA 2.0

    1. 1. Series Overview<br />Data Access with JPA<br />Distributed Caching with Coherence<br />Message Driven and Web Services with Spring<br />RESTful Web Services with JAX-RS and Javascript UI with JQuery<br />Troubleshooting and tuning<br />©2010 Oracle Corporation <br />1<br />
    2. 2. Next Session: Distributed Caching with Coherence<br />Learn how to:<br />Integrate Coherence with JPA<br />Manage Coherence Servers and Clusters from WebLogic Admin Console<br />©2010 Oracle Corporation <br />2<br />
    3. 3. The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions.<br />The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.<br />3<br />
    4. 4. WebLogic Java Developer Webcast1. Data Access with JPA<br />Shaun SmithProduct Manager—Oracle TopLinkSohailDadaniSr. Sales Consultant<br />
    5. 5. Java Persistence API (JPA)—in a Nutshell<br />Defines:<br />How Java objects are stored in relational<br />A programmer API for reading, writing, and querying persistent Java objects (“Entities”)<br />A full featured query language in JP QL<br />a container contract that supports plugging any JPA runtime in to any compliant container<br />Java SE/EE<br />Application<br />Java Classes<br />JPA Provider<br />JDBC Driver<br />PersistenceDescriptors<br />Database Schema<br />
    6. 6. JPA—Background<br />A standardization of industry practices for Java POJO Object Relational Persistence<br />Developed as part of the EJB 3.0 specification but now spun off into its own specification (JSR 317)<br />Suitable for use in different modes<br />Standalone in Java SE environment<br />Hosted within a Java EE Container <br />Merging of expertise from persistence vendors and communities including: TopLink, Hibernate, JDO, EJB vendors and individuals<br />
    7. 7. Oracle TopLink 11gR1<br />Oracle’s Enterprise Java Persistence Framework<br />Includes open source EclipseLink with Commercial Support<br />Certified on and part of the Oracle WebLogic application server<br />Includes TopLink Grid: JPA integration with Coherence<br />Supports scaling JPA applications into very large clusters<br />Development tool support in Eclipse OEPE, JDeveloper, and NetBeans<br />
    8. 8. Customer<br />id: int<br />name: String<br />creditRating: int<br />CUST<br />Object-Relational Mapping<br />The activity of ‘Mapping’ is the process of connecting objects/attributes to tables/columns<br />ID<br />NAME<br />C_RATING<br />
    9. 9. Mapping with Annotations<br />@Entitypublic class Customer { <br />@Id<br />private Stringname;<br />@OneToOne<br />private Account account;<br />public String getName() { return name; }<br />public voidsetName(String name) {<br />this.name = name;<br />}<br />public Account getAccount() { return account; }<br />public void setAccount(Account account) {<br />this.account = account;<br />}<br />}<br />
    10. 10. Mappings with XML<br /><entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"<br />…<br /><entityclass=“Customer"><br /> <attributes><br /><idname=“name“/><br /><one-to-onename=“account“/><br /> </attributes><br /></entity><br />…<br /></entity-mappings><br />
    11. 11. Typical Development Approaches<br />Bottom Up<br />Start from a database schema and generate JPA entities<br />A good way to bootstrap a project if you’re building on an existing database<br />Top Down<br />Generate database schema from JPA entities<br />A good way to get started in a green field development—focus on developing a good Java domain model<br />Meet in the Middle<br />Map Java classes to an existing database schema<br />Maps optimized Java domain model to an optimized database schema—typically follows Bottom Up and Top Down<br />
    12. 12. Our Development Scenario<br />Building a simple JAX-RS fronted Java application that interacts with a relational database<br />Starting from an XSD that describes the documents the system must support<br />Technologies we’ll use: JPA, JAXB, and JAX-RS<br />Development Approach:<br />Use JAXB Schema compiler to generate JAXB annotated POJOS<br />Follow JPA “Top Down” approach by defining JPA mappings for generated classes and then generating a database schema from those mapped classes.<br />
    13. 13. JPA in Java EE<br />
    14. 14. JPA in EJB<br />
    15. 15. OracleWebLogic YouTube Channelwww.YouTube.com/OracleWebLogic<br />©2010 Oracle Corporation <br />15<br />

    ×