Object persistence with Hibernate in Decision Deck 1.1 Gilles Dodinet 2 nd Decision Deck Workshop 2008, 21-22 February.

Slides:



Advertisements
Similar presentations
Copyright ©2010 Oracle Corporation Made available under Creative Commons Attribution-Share Alike 3.0 Unported EclipseLink Runtime Architecture Data Source.
Advertisements

Persistence Jim Briggs 1. 2 Database connectivity: JDBC Java Database Connectivity An API for connecting Java programs (applications, applets and servlets)
NHibernate Object/Relational Persistence for.NET.
Apache Struts Technology
Spring, Hibernate and Web Services 13 th September 2014.
.NET Database Technologies: Open-Source Frameworks.
An architecture for webb applications, J2EE
Integrating SOA and the Application Development Framework Shaun O’Brien Principal Product Manager – Oracle JDeveloper / ADF.
Why OSGi matters for Enterprise Java Infrastructures
Hibernate 1. Introduction ORM goal: Take advantage of the things SQL databases do well, without leaving the Java language of objects and classes. ORM.
Presented by IBM developer Works ibm.com/developerworks/ 2006 January – April © 2006 IBM Corporation. Making the most of Creating Eclipse plug-ins.
Groovy & Grails Jean Barmash CTO, EnergyScoreCards.com
Apache Struts Technology A MVC Framework for Java Web Applications.
Session-01. Hibernate Framework ? Why we use Hibernate ?
Emmanuel Cecchet et al.  Performance Scalability of J2EE application servers.  Test effect of: ◦ Application Implementation Methods ◦ Container Design.
Address - #22, 1 st Floor, Station View Road, Kodambakkam, Chennai JTech Soft Solutions Website:
An Introduction to Hibernate Matt Secoske
Data Persistence and Object-Relational Mapping Slides by James Brucker, used with his permission 1.
Hibernatification! Roadmap for Migrating from Plain Old SQL on JDBC to JPA on Hibernate Duke Banerjee Senior Developer, DrillingInfo.com.
CSE446 S OFTWARE Q UALITY M ANAGEMENT Spring 2014 Yazılım ve Uyguluma Geliştirme Yöneticisi Orhan Başar Evren.
Software Engineering Muhammad Fahad Khan
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 18 Slide 1 Software Reuse.
1 INTRO TO BUSINESS COMPONENTS FOR JAVA (BC4J) Matt Fierst Computer Resource Team OracleWorld Session
OSGi.
Maven for building Java applications By Nalin De Zoysa
NHibernate in Action Web Seminar at UMLChina By Pierre Henri Kuaté 2008/08/27
Persistence Store Project Proposal.
CHAPTER 14 USING RELATIONAL DATABASES TO PROVIDE OBJECT PERSISTENCE (ONLINE) © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database.
Object Oriented Analysis and Design 1 Chapter 7 Database Design  UML Specification for Data Modeling  The Relational Data Model and Object Model  Persistence.
OSGi in action BlueDavy
Introduction to Web Dimitar Nenchev Ivan Nakov
Open Service Gateway Initiative (OSGi) Reporter : 林學灝 侯承育 1.
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 14 Using Relational Databases to Provide Object Persistence (Overview) Modern Database.
JBoss at Work Databases and JBoss Chapter 4 Jeff Schmitt October 26, 2006.
Tool Integration with Data and Computation Grid GWE - “Grid Wizard Enterprise”
An Introduction to Object/Relational Persistence and Hibernate Yi Li
Ganymede Simultaneous Release | © 2008 by Springsite B.V., The Netherlands made available under the EPL v1.0 Teneo Ganymede Simultaneous Release.
JPA / HIBERNATE CSCI 6370 Nilayan Bhattacharya Sanket Sable.
Fall CIS 764 Database Systems Engineering L18.2 : Object Relational Mapping … ….Object persistence.
Overview and update Pete Raymond. » Purpose of this presentation » Background » JSR Requirements » Key concepts » Relationship to other standards/approaches.
Topic : Hibernate 1 Kaster Nurmukan. An ORM tool The problem fixed by ORM Advantage Hibernate Hibernate Basic –Hibernate sessionFactory –Hibernate Session.
1 Nov 29, 2005 Object Relational Mapping Frameworks Wiene Höweler.
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.
By Srinivas Mahakud Java Persistence API JPA. Review Topics: Introduction what is the JPA? What is the JPA contains of? Why developers should Create the.
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.
Java Programming: Advanced Topics 1 Enterprise JavaBeans Chapter 14.
Topic : Hibernate 1 Kaster Nurmukan. An ORM tool Used in data layer of applications Implements JPA.
Fundamentals of MyBATIS
JPA in Vaadin CSCI 3130 Winter What is JPA?  Java Persistence API  Allows for “easy” storage of Java Objects  Is a type of Object Relational.
Singleton Academy, Pune. Course syllabus Singleton Academy Pune – Course Syllabus1.
.  A reference model developed for an important use case (Air Job) including UI widgets, controllers, services and DAOs.  After full requirement analysis.
Introduction to ORM Hibernate Hibernate vs JDBC. May 12, 2011 INTRODUCTION TO ORM ORM is a programming technique for converting data between relational.
ORM Basics Repository Pattern, Models, Entity Manager Ivan Yonkov Technical Trainer Software University
 Who I am  What is NHibernate? ◦ Object Relational Mapper ◦ A framework for building advanced frameworks ◦ Ported from Java ◦ A wide NHibernate ecosystem.
Apache Struts Technology A MVC Framework for Java Web Applications.
CS520 Web Programming Object-Relational Mapping with Hibernate and JPA (I) Chengyu Sun California State University, Los Angeles.
J AVA T RAINING IN A HMEDABAD By TOPS Technologies 1 TOPS Technologies Java Course.
Hibernate Java Persistence API. What is Persistence Persistence: The continued or prolonged existence of something. Most Applications Achieve Persistence.
Reactor An ORM framework for ColdFusion Presentation By: Doug Hughes
Enterprise Library 3.0 Memi Lavi Solution Architect Microsoft Consulting Services Guy Burstein Senior Consultant Advantech – Microsoft Division.
Fall CIS 764 Database Systems Engineering L11: Object Relational Mapping … (a) ORM, Object persistence (b) Pets sequence.
Persistence – Iteration 4 Vancouver Bootcamp
Introduction to J2EE Architecture
Design and Maintenance of Web Applications in J2EE
Distributed System Using Java 2 Enterprise Edition (J2EE)
ESIS Consulting LLC (C) ESIS Consulting LLC. All rights reserved
Teneo Ganymede Simultaneous Release Graduation Review
Developing and testing enterprise Java applications
Teneo Ganymede Mini Deck
Presentation transcript:

Object persistence with Hibernate in Decision Deck 1.1 Gilles Dodinet 2 nd Decision Deck Workshop 2008, February

2nd Decision Deck workshop 2 D2 1.1 changes overview Move from manual SQL writing to a persistence managed solution –JPA, Hibernate –Simplicity & Productivity –Robustness (wrt model changes) Standard-based plugin mechanism –Based on OSGi: highly dynamic component specification Unified model event mechanism –« Let me know when it is changed »

2nd Decision Deck workshop 3 Agenda D x architecture recap –Persistence handling –Modularity concerns –Plugin descriptor D Changes –ORM and JPA overview –Persistence handling with Hibernate –Getting your feet wet –Induced changes In practice –Decision Deck Eclipse plugin

2nd Decision Deck workshop 4 D : architecture recap Object persistence: Raw JDBC Modularity concerns: Classworld Plugin description: plugin.xml

2nd Decision Deck workshop 5 Persistence handling in D x Raw JDBC –Verbose –Broke the DRY principle –Tedious, repititive task –But: as powerful as needed Custom SQL Framework –No multiple joins –Missed a few SQL constructs –Almost as verbose as Raw JDBC

2nd Decision Deck workshop 6 Modularity concern in D x Plugin isolation is a requirement Classloading issues dealt with Classworld Drawbacks –Custom management of native libraries –No « Buddy-like » mechanism Main OSGi features reimplemented

2nd Decision Deck workshop 7 Plugin descriptor in D x org.decisiondeck.MyPlugin 1.0 org.decisiondeck.my.MyPlugin ….....

2nd Decision Deck workshop 8 D : What changed ? Persistence now handled with Hibernate Border-side consequences: –We moved from Classworld to OSGi –Plugin descriptor is now much lighter –Service layer does not act anymore as a global object cache Minor changes –All projects stored in the same database –A few API changes (naming)

2nd Decision Deck workshop 9 Object Relational Mapping The Impedance Mismatch –How to reconcile two (concurrent) different (logical) representations of the same concept? Solving the Impedance Mismatch –Either manually through raw JDBC (and raw SQL) –Or with the help of ORM frameworks In either case there are a few common patterns to be aware of: –How to map inheritance : single table, one table per concrete class, join tables –How to map relationships : one-to-many, many-to-many, many-to-one

2nd Decision Deck workshop 10 Java Persistence Api Initial objective –Simplify EJB CMP entity beans development –Developed as part of JSR-220 JPA usable in J2EE as well as in J2SE In a nutshell –ORM layer standardization –Mapping description Java 5 annotations and/or XML –Data Access API Pluggable providers (Hibernate, Toplink, JPox, etc.) –SQL-Like query language

2nd Decision Deck workshop 11 Object persistence in D2 1.1 Database query through Hibernate Core API –Criteria API available –Control session (un)loading Mapping specified with JPA annotations Persistent entities registered in plugin.xml Generic Accessor provided –Simple CRUD –A few aggregate functions (count,..)

2nd Decision Deck workshop 12 Hibernate Session object Quoting hibernate documentation: –The Session « is the central API class abstracting the notion of a persistence service. » Manages entities lifecycle –Transient  Persistent  Detached Main operations: –save(), update(), delete(), merge()

2nd Decision Deck workshop 13 Using Hibernate in D A single Hibernate Session is used throughout the whole application Session is opened when opening a project, closed when closing a project Most of Hibernate complexity is hidden in GenericDao and DaoRegistry The current Session can be easily retrieved via the GenericDao getSession() method

2nd Decision Deck workshop 14 Querying with Hibernate: HQL Hibernate Query Language –Query language similar to SQL –Object oriented Criteria API –A simple object oriented way to build queries In either case –Support for aggregate functions

2nd Decision Deck workshop 15 D 2 Data Access API (Java 5) Generics Concrete generic DAO Project dependent entity DAO Implements Extends

2nd Decision Deck workshop 16 Dao Registration Plugin’s DAO must be registered –The registry can instantiate them –They can be retrieved by key –DaoRegistry#register(key, classname) They must be unregistered to clean up resources –DaoRegistry#unregister(key) Plugin class controls the plugin lifecycle –Registration occurs during plugin startup –Deregistration occurs at plugin shutdown

2nd Decision Deck workshop 17 Model Events PropertyChanged event not used anymore Centralized « Model Events » management –Homogenization –Strongly typed –Easier debugging

2nd Decision Deck workshop 18 Handling references Fact –Hibernate imposes strong relational integrity (good practice) Example –Criterion does not know anything about CriterionRefinement –Criterion deletion may fail if there exist some refinement Resolution –CriterionRefinement provider must register a ModelEvent listener to monitor Criterion deletions –Throw VetoException if needed

2nd Decision Deck workshop 19 Induced changes Problem –Hibernate needs to see the persistent classes –D x classloading relies on Classworld which does not allow two-way visibility by default Solutions –Severely refine classloading mechanism –Drop Classworld in favor to OSGi OSGi –« The Dynamic Module System for Java™ » –Covers all our classloading needs –Equinox Buddy mechanism allows to bypass classloader isolation default rules –Unit of deployment is called a bundle

2nd Decision Deck workshop 20 OSGi in D Advantages –Greatly simplify classloading management –Service-oriented platform Bundle configuration –MANIFEST.MF Especially defines the dependencies: in D x they were defined through the tag in plugin.xml –plugin.xml : D 2 specific configuration Identification Services Entities Eclipse D² Plugin wizard –Generates a full functional example

2nd Decision Deck workshop 21 Questions …

2nd Decision Deck workshop 22 Resources JPA on the desktop – SE/Desktop/persistenceapi/ Getting started with Hibernate – OSGi in a nutshell – shell.html D 2 plugin migration guide – deck.sourceforge.net/migrate/migration-guide.html