UPortal Developers MIT August 2004 Persistence Strategy for uPortal 3 Mike DeSimone the r-smart group

Slides:



Advertisements
Similar presentations
An Object/Relational Mapping tool Free and open source Simplifies storage of object data in a relational database Removes the need to write and maintain.
Advertisements

Connecting to Databases. relational databases tables and relations accessed using SQL database -specific functionality –transaction processing commit.
1 juni 30, 2005 Spring JDBC. 2 juni 30, 2005 Doel Database acties Flexibel Gecontroleerd Productief.
Spring, Hibernate and Web Services 13 th September 2014.
.NET Database Technologies: Open-Source Frameworks.
Basic JDBC Celsina Bignoli What is JDBC Industry standard for database- connectivity between the Java language and a wide range of.
© 2005, Cornell University. Rapid Application Development using the Kuali Architecture (Struts, Spring and OJB) A Case Study Bryan Hutchinson
Session-01. Hibernate Framework ? Why we use Hibernate ?
Intro to Spring CJUG - January What is Spring? “The Spring framework provides central transaction control of various objects.” This means that any.
Using Third-Party Frameworks in Building Blocks™ David Ashman Principal Architect, Product Development.
An Introduction to Hibernate Matt Secoske
The Spring Framework A quick overview. The Spring Framework 1. Spring principles: IoC 2. Spring principles: AOP 3. A handful of services 4. A MVC framework.
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.
Training - Day 3 OJB. What is OR Mapping? OR Mapping is the mapping of relational database tables to objects (Java Objects in our case) Many OR Mapping.
NetArchive Suite Workshop 2011 Technical Track - Code refactoring with the Spring Framework.
1 Java Database Connection (JDBC) There are many industrial-strength DBMS's commercially available in the market. Oracle, DB2, and Sybase are just a few.
Think Possibility Integrating Web Applications With Databases.
Agenda What is Hibernate Spring Integration Questions Overview
Beginning Databases with JDBC Mike Bradley Adapted from and notes by Kevin Parker, Ph.D.
Introduction to the Spring Framework Rajesh. Spring Mission Statement J2EE should be easier to use OO design is more important than any implementation.
NHibernate in Action Web Seminar at UMLChina By Pierre Henri Kuaté 2008/08/27
OpusCollege and the use of Spring and iBatis
CHAPTER 14 USING RELATIONAL DATABASES TO PROVIDE OBJECT PERSISTENCE (ONLINE) © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database.
Seminar on. Overview Hibernate. What is it? Hibernate. How does it work? Hibernate Tools.
Anti Orgla, Nortal AS Spring Framework
Spring Framework. Spring Overview Spring is an open source layered Java/J2EE application framework Created by Rod Johnson Based on book “Expert one-on-one.
Object Oriented Analysis and Design 1 Chapter 7 Database Design  UML Specification for Data Modeling  The Relational Data Model and Object Model  Persistence.
JDBC. JDBC stands for Java Data Base Connectivity. JDBC is different from ODBC in that – JDBC is written in Java (hence is platform independent, object.
JDBC Java and Databases. RHS – SOC 2 JDBC JDBC – Java DataBase Connectivity An API (i.e. a set of classes and methods), for working with databases in.
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 14 Using Relational Databases to Provide Object Persistence (Overview) Modern Database.
Spring Database Access Ojitha Kumanayaka Copyright © Virtusa, 2007.
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.
Hibernate 3.0. What is Hibernate Hibernate is a free, open source Java package that makes it easy to work with relational databases. Hibernate makes it.
JDBC Enterprise Systems Programming. JDBC  Java Database Connectivity  Database Access Interface provides access to a relational database (by allowing.
Copyright © 2002 ProsoftTraining. All rights reserved. Building Database Client Applications Using JDBC 2.0.
Struts Framework Anna Paščenko. What is Struts?  An open source framework for building Java web applications.
JPA / HIBERNATE CSCI 6370 Nilayan Bhattacharya Sanket Sable.
Persistence – Iteration 4 Vancouver Bootcamp Aaron Zeckoski
JDBC CS 124. JDBC Java Database Connectivity Database Access Interface provides access to a relational database (by allowing SQL statements to be sent.
12/6/2015B.Ramamurthy1 Java Database Connectivity B.Ramamurthy.
Text 16 de mayo de 2009 Spring Framework Part III. Portable Service Abstractions Buenos Aires, June 2009.
Topic : Hibernate 1 Kaster Nurmukan. An ORM tool The problem fixed by ORM Advantage Hibernate Hibernate Basic –Hibernate sessionFactory –Hibernate Session.
All information's of PLINQO in this Document, I got it from: So, you could visit the link above to research.
Persistence – Iteration 4 Vancouver Bootcamp Aaron Zeckoski
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Introduction to Data Access with Spring.
Kansas City Java User’s Group Jason W. Bedell July 12, 2006
Text 16 de mayo de 2009 Spring Framework Part III. Portable Service Abstractions Buenos Aires, June 2009.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Overview of the Spring Framework Introducing.
Topic : Hibernate 1 Kaster Nurmukan. An ORM tool Used in data layer of applications Implements JPA.
Introduction – ORM, Helloworld Application
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Introduction to Spring JDBC Simplifying.
Spring JDBC Dima Ionut Daniel. Contents What is Spring JDBC? Overview Spring JDBC Core SQL Exceptions Database Connection Batch Operations Handling BLOB/CLOB.
Fundamentals of MyBATIS
Introduction to ORM Hibernate Hibernate vs JDBC. May 12, 2011 INTRODUCTION TO ORM ORM is a programming technique for converting data between relational.
Text 16 de mayo de 2009 Spring Framework Part III. Portable Service Abstractions and Spring MVC Buenos Aires, June 2009.
CS422 Principles of Database Systems Object-Relational Mapping (ORM) Chengyu Sun California State University, Los Angeles.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
Hibernate Java Persistence API. What is Persistence Persistence: The continued or prolonged existence of something. Most Applications Achieve Persistence.
New Technology: Why, What ,How
Web Technologies IT230 Dr Mohamed Habib.
Persistence – Iteration 4 Vancouver Bootcamp
Monitoring Java Applications with JAMon
Intro to Spring CJUG - January 2013.
Client Access, Queries, Stored Procedures, JDBC
Testing a persistence layer
Developing and testing enterprise Java applications
SPL – PS13 Persistence Layer.
Presentation transcript:

uPortal Developers MIT August 2004 Persistence Strategy for uPortal 3 Mike DeSimone the r-smart group

August 2004uPortal Developers MIT Summary Quick review of uPortal 2.x persistence Quick review of uPortal 2.x persistence Candidates for v3 Candidates for v3 Code samples Code samples

August 2004uPortal Developers MIT uPortal v2.x Persistence Straight low-level JDBC Straight low-level JDBC 1 service class (provides getConnection, etc.) 1 service class (provides getConnection, etc.) 3-4 classes sort of roughly divided into function areas 3-4 classes sort of roughly divided into function areas 1 of these is large (3k lines!) 1 of these is large (3k lines!) Evolution leading to maintainability challenges Evolution leading to maintainability challenges

August 2004uPortal Developers MIT uPortal v2.x Persistence Issues Some recent issues: Some recent issues: –ResultSet’s left open –Abandoned connections Missing keys/indices in generated DDL (xsl fix) Missing keys/indices in generated DDL (xsl fix) Performance issues (remove extra row copying during login) Performance issues (remove extra row copying during login)

August 2004uPortal Developers MIT Deciding for v3 Why change Why change Choosing the DAO model Choosing the DAO model Goal: Separate business logic from data access Goal: Separate business logic from data access Enable easy substitution of alternatives Enable easy substitution of alternatives Leverage Spring’s dependency injection (was: IoC) Leverage Spring’s dependency injection (was: IoC)

August 2004uPortal Developers MIT Deciding for v3 Candidates to implement: ORM, Spring support, no change Candidates to implement: ORM, Spring support, no change ORM: JDO, Hibernate ORM: JDO, Hibernate iBATIS SqlMaps iBATIS SqlMaps Spring JDBC support Spring JDBC support

August 2004uPortal Developers MIT Comparing Persistence (iBATIS) + has a somewhat simpler xml configuration setup than hibernate, but not trivial + has a somewhat simpler xml configuration setup than hibernate, but not trivial - seems geared towards persisting objects that have basic types (int, string), although one can configure more complex object persistence - seems geared towards persisting objects that have basic types (int, string), although one can configure more complex object persistence - stability & longevity are unknowns to me - stability & longevity are unknowns to me

August 2004uPortal Developers MIT Comparing Persistence (Hibernate) requires many fewer lines of java code for many operations requires many fewer lines of java code for many operations + provides caching of objects & lazy-initialization, among other performance enhancements + provides caching of objects & lazy-initialization, among other performance enhancements - requires extensive, fairly complex xml configuration files to perform the object relational mapping - requires extensive, fairly complex xml configuration files to perform the object relational mapping + understands many major DBMS sql dialects; generates SQL automatically for the database schema & related queries + understands many major DBMS sql dialects; generates SQL automatically for the database schema & related queries - has a hefty learning curve for effective use - has a hefty learning curve for effective use

August 2004uPortal Developers MIT Comparing Persistence (Spring JDBC) + pretty close to vanilla JDBC with some features to minimize try/catch craziness & to handle connections automatically. + pretty close to vanilla JDBC with some features to minimize try/catch craziness & to handle connections automatically. - requires quite a bit of Java code to implement the persistence, but not much xml configuration - requires quite a bit of Java code to implement the persistence, but not much xml configuration - does not provide any sort of caching - does not provide any sort of caching

August 2004uPortal Developers MIT Factors in choosing a “winner” Nobody’s a “luser” Nobody’s a “luser” Easier than JDBC? Easier than JDBC? Maturity, Stability Maturity, Stability Community vibrancy/activity Community vibrancy/activity Minimize barriers to future contributors Minimize barriers to future contributors

August 2004uPortal Developers MIT Spring JDBC support Package Package org.springframework.jdbc.object allows DB access in OO manner allows DB access in OO manner Execute queries and get the results back as a list containing business objects with the relational column data mapped to the properties of the business object. (from spring doc)

August 2004uPortal Developers MIT Spring JDBC support Extend MappingSqlQuery for Select’s Extend SqlUpdate for insert, update Implement mapRow to map relational data to Java objects Inject the datasource Transaction support is transparent to code

August 2004uPortal Developers MIT Data Model Snippet Focus on UP_PORT_DEF_PREF for this example Focus on UP_PORT_DEF_PREF for this example

August 2004uPortal Developers MIT Spring Config XML

August 2004uPortal Developers MIT UP_PORT_DEF_PREF dao example Add transaction manager; no Java impact Add transaction manager; no Java impact PROPAGATION_REQUIRED

August 2004uPortal Developers MIT UP_PORT_DEF_PREF dao example constructor (ds injected by spring framework): constructor (ds injected by spring framework): PortletDefPrefQuery(DataSource ds) { super(ds, "SELECT " + COL_PREF_NAME + "," + COL_READ_ONLY + " FROM " + TBL_PORTLET_DEF_PREF + " WHERE " + COL_DEF_ID + "=?"); super(ds, "SELECT " + COL_PREF_NAME + "," + COL_READ_ONLY + " FROM " + TBL_PORTLET_DEF_PREF + " WHERE " + COL_DEF_ID + "=?"); super.declareParameter(new SqlParameter("def id", Types.INTEGER)); super.declareParameter(new SqlParameter("def id", Types.INTEGER)); compile(); compile();

August 2004uPortal Developers MIT UP_PORT_DEF_PREF dao example mapRow mapRow protected Object mapRow(ResultSet rs, int rowNum) throws SQLException { protected Object mapRow(ResultSet rs, int rowNum) throws SQLException { IPreference pref = new PreferenceImpl(); IPreference pref = new PreferenceImpl(); pref.setName(rs.getString(COL_PREF_NAME)); pref.setName(rs.getString(COL_PREF_NAME)); pref.setReadOnly(rs.getBoolean(COL_READ_ONLY)); pref.setReadOnly(rs.getBoolean(COL_READ_ONLY)); return pref; return pref; } Spring framework passes in result set Spring framework passes in result set

August 2004uPortal Developers MIT Conclusion Using DAO design pattern for more flexibility Using DAO design pattern for more flexibility Spring JDBC improves productivity & decreases common straight JDBC coding errors Spring JDBC improves productivity & decreases common straight JDBC coding errors Code to interfaces Code to interfaces