A digital commerce consultancy san francisco ~ new york ~ london ~ chişinău ~ guadalajara Apache Cayenne Object Relational Mapping.

Slides:



Advertisements
Similar presentations
WaveMaker Visual AJAX Studio 4.0 Training
Advertisements

Developing in CAS. Why? As distributed you edit CAS 3 with Eclipse and build with Maven 2 – Best Practice for Release Engineering – Difficult edit-debug.
WEXTOOL User Guide v1.0 E.P. PLANETE B.B.R.. Plan Introduction & Architecture of Wextool Installation Scenario description Experimentation phase Saving/Synchronizing.
Developing CAS in Eclipse
Sapana Mehta (CS 6V81) Instructions for using Jboss User Manual.
Using the Class Dependency Analyzer for OODT By Joshua Garcia.
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
A complete web app using flex. You can use the flex builder to generate the php (server side) code for a flex-php application. As before, Php connects.
Current Topics in Programming Languages Lecture 15_1 George Koutsogiannakis SUMMER
Web Applications Basics. Introduction to Web Web features Clent/Server HTTP HyperText Markup Language URL addresses Web server - a computer program that.
ECE356 – Database Systems Lab 1 – Building a Web Project with NetBeans Tiuley Alguindigue Lab Instructor – University of Waterloo, E & CE Dept. Fall 2013.
Session-01. Hibernate Framework ? Why we use Hibernate ?
Configuring Apache tomcat Specifying the server port NOTE: Edit the install_dir/conf/server.xml and change the port attribute of the connector element.
Tomcat Celsina Bignoli History of Tomcat Tomcat is the result of the integration of two groups of developers. – JServ, an open source.
Open source administration software for education research administration Lin-Long Shyu System Analyst Kuali Coeus Technical Team Indiana University
Open source administration software for education 2012 User Conference April 22-24, 2012 – Atlanta, Georgia “Together Toward Tomorrow” Chris Denne, Colorado.
SEEM4570: XAMPP, Eclipse, Summary of Html Kangfei Zhao Room 711,ERB
Data Persistence and Object-Relational Mapping Slides by James Brucker, used with his permission 1.
JSP and Servlets Lecture notes by Theodoros Anagnostopoulos.
Introduction to JPA Java Persistence API Introduction to JPA.
Object and object-relational databases 1. Object databases vs. Object-relational databases Object databases Stores complex objects – Data + functions.
E-Commerce LAB#1 Samia alblwi1E-Commerce ( IS412) 2011.
Chapter 10 EJB Concepts of EJB Three Components in Creating an EJB Starting/Stopping J2EE Server and Deployment Tool Installation and Configuration of.
Fall CIS 764 Database Systems Engineering L3: Two Assignments Relating to J2EE.
CSCI 6962: Server-side Design and Programming
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Modern Software Technologies Java™, J2EE™, JSP™, JDBC™ by Radoslav Tr. Ivanov
® IBM Software Group © 2006 IBM Corporation Kick-start your Java Apps: Free Software, fast development Eclipse IDE, WASCE, DB2 Express-C.
Project confidential Page 1 20-Jan-09 Integrated Project – EC FP AspireRFID Developers First CodeCamp Athens Information Technology Nikos Kefalakis.
NHibernate in Action Web Seminar at UMLChina By Pierre Henri Kuaté 2008/08/27
© D. Wong  Indexes  JDBC  JDBC in J2EE (Java 2 Enterprise Edition)
TDDD05 EJB Lab (Part of slides reused from Mikhail’s) Lu Li
JBoss at Work JAW Motors Application Chapter 1-3 Jeff Schmitt October 9, 2006.
Dali JPA Tools. About Dali Dali JPA Tools is an Eclipse Web Tools Platform sub-Project Dali 1.0 is a part of WTP 2.0 Europa coordinated release Goal -
12-CRS-0106 REVISED 8 FEB 2013 CSG2H3 Object Oriented Programming.
Presented by: SIF3 Framework Install - Java Joerg Huber Install & Verify Instructions and Exercise.
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.
(1) Introduction to Models using the Play Framework Philip Johnson Collaborative Software Development Laboratory Information and Computer Sciences University.
Topic Java EE installation (Eclipse, glassfish, etc.) Eclipse configuration for EE Creating a Java Web Dynamic Project Creating your first servlet.
Creating ontology Hands on! universAAL Training Day Barcelona, Spain 16 January 2014
JDBC Tutorial CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Packaging for Voracity Solutions Control Panel David Turner.
JPA / HIBERNATE CSCI 6370 Nilayan Bhattacharya Sanket Sable.
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Sakai development and app/tool tips Aaron Zeckoski
Fall CIS 764 Database Systems Engineering L18.2 : Object Relational Mapping … ….Object persistence.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
CMap Version 0.16 Ben Faga. CMap CMap Version 0.16 Bug fixes and code optimizations More intuitive menu system Asynchronous loading of comparative map.
Database Access Using JDBC BCIS 3680 Enterprise Programming.
WAMP Server Installatin Shiyun Wen. WAMP Server Installation  WAMP Server is an integrated installation of Apache, MySQL, and PHP for Windows. Following.
Syllabus Management System Matt Bernstein, Paul Capelli, Jared Segal.
© 2012 LogiGear Corporation. All Rights Reserved FitNesseFitNesse Authors: Nghia Pham 1.
CSC 520 – Advanced Object Oriented Programming, Fall, 2010 Thursday, October 14 Week 7, UML Diagrams
® IBM Software Group © 2006 IBM Corporation Rational Asset Manager v7.2 Using Scripting Tutorial for using command line and scripting using Ant Tasks Carlos.
Introduction – ORM, Helloworld Application
UpgradinguPortal to What’s new that matters Better use of third party frameworks Faster! Improved caching Drag and Drop New Skin & Theme Accessibility.
Google App Engine using Java 1. Outline Getting started Guestbook example Todo example Simplified Madlib 2.
Maven. Introduction Using Maven (I) – Installing the Maven plugin for Eclipse – Creating a Maven Project – Building the Project Understanding the POM.
Hibernate Java Persistence API. What is Persistence Persistence: The continued or prolonged existence of something. Most Applications Achieve Persistence.
WMarket For Adminstrators Manual Installation. Basic Dependencies To install your own WMarket instance, you are required to install the following software:
CS520 Web Programming Introduction to Maven Chengyu Sun California State University, Los Angeles.
Google App Engine using Java 1. Outline Getting started Guestbook example Todo example Simplified Madlib 2.
16 Copyright © 2004, Oracle. All rights reserved. Testing the Migrated Oracle Database.
OOS SQUARE SQUARE Lab Deployment Diagram *UML 2 and the Unified Process Second Edition 을 인용하여 작성됨.
Fall CIS 764 Database Systems Engineering L11: Object Relational Mapping … (a) ORM, Object persistence (b) Pets sequence.
Web Routing Designing an Interface
Tomcat Celsina Bignoli
A very brief introduction
ESIS Consulting LLC (C) ESIS Consulting LLC. All rights reserved
CS4961 Software Design Laboratory Understand Aquila Backend
Oracle SQL Developer Data Modeler
Presentation transcript:

a digital commerce consultancy san francisco ~ new york ~ london ~ chişinău ~ guadalajara Apache Cayenne Object Relational Mapping

What is ORM? ORM stands for Object Relational Mapping. It is a technique that creates an object oriented data model on top of a Relational Database.

Persistence Persistence means that the data used in a software application survives the application process. In other words, once you stop using or close the application the data will remain stored in a (relational) database. In Java terms, we would like the state of some of our objects to live beyond the JVM so that the same state is available later.

Object-Relational Impedance Mismatch Impedance mismatch refers to the structural differences between a Relational Database and an Object Oriented Database. In order to do the mapping between both, we must overcome the following problems: – Granularity. – Subtypes (Inheritance). – Identities. – Associations. – Access to the information.

Frameworks for ORM Hibernate. EclipseLink. Data Knowledge Objects. jOOQ. Enterprise Java Beans EJB3. Apache Cayenne.

Prerequisites Have already installed: – Java 7. – Eclipse EE with Maven plugin. – Install any *AMP server or MySQL from scratch. – Apache Cayenne Modeler 3.0 version. – MySQL JDBC driver. It is important to have the required versions because there are syntax changes from version to version.

Getting Started The next step is to follow the Getting Started tutorial from the Cayenne website: We are going to build a simple web application that has this database design:

Hands On 1.Create a Maven Project in Eclipse. – File > New > Project > Other > Maven > Maven Project > Simple project – Group Id: org.example.cayenne – Artifact Id: tutorial 2.Create a Cayenne Modeler Project. –New Project > Project –DataDomain Name > datadomain 3.Create a MySQL database in PHPMyAdmin –Start the Apache and MySQL servers – Open PHPMyAdmin –Databases > testdb > Create

Cayenne Modeler New Project > Project Create Data Node > datanode – Datanode Name: datanode – JDBC Driver: com.mysql.jdbc.Driver – DB URL: jdbc:mysql://localhost:3306/testdb (port might change) – User: root – Password: Create DataMap – DataMap Name: datamap – DataNode: datanode – Java Package: org.example.cayenne.persistent – Save the project in: tutorial/src/main/resources

Cayenne Modeler Create the database tables: –datamap > Create DB Entity –Name: ARTIST –Create Attribute: ID, INTEGER, PK –Repeat the steps for the Painting and Gallery tables. Create relations between tables: – Select DB Entity ARTIST. – Select Relationships and Create Relationship. – Target: Painting. – Select Database Mapping. Relationship: PAINTING; Reverse: ARTIST; Source: ID; Target: ARTIST_ID – In the paintings relation from ARTIST select To Many. – In the artist relation from PAINTING unselect To Many. – Repeat the same process for the GALLERY to PAINTING relation.

Cayenne Modeler Create entities for class generation: – Right click on ARTIST and click CREATE OBJECT ENTITY. – Select the generated object and click synchronize relationships. Generate Java Classes: – Tools > Generate Classes – Output Directory: tutorial/src/main/java – Classes > Check All Classes – Generate

Eclipse Refresh the workspace and solve the dependencies: – Refresh (F5). – Edit the file pom.xml to look like in the following link: –

Cayenne Modeler Generate the Database Schema: – Tools > Preferences > ClassPath > Add Jar and select the JAR file for MySQL Connector J – Tools > Generate Database Schema. – Username: root – Password:

Eclipse Create Main class in the org.example.cayenne package. – – Add the MySQL J Connector dependency to the pom.xml file. – Refer to the following page in the tutorial: – – Add the setDateOfBirth method to Artist.java – In the Main class, write the code to add one painter, two paintings and one gallery. – Run the code and check the results in phpMyAdmin. – Then try the delete rules proposed in the tutorial: –

Eclipse Go to in order to convert our Applcation it into a Web Application: – Create the folder src/main/webapp/WEB-INF – Create the file web.xml into src/main/webapp/WEB-INF – Create the file webapp/index.jsp – Create the file webapp/detail.jsp – Add the dependencies of maven-jetty-plugin to the pom.xml Create an execution configuration for Maven: – Run > Run Configurations > Maven Build > New – Name: cayenne-tutorial – Base directory: ${workspace_loc:/tutorial} – Goals: jetty:run – Apply > Run – Go to – Enhance your web application so it can add paintings to an artist.