SlideShare una empresa de Scribd logo
1 de 34
Descargar para leer sin conexión
Andreas Martin - Page 1
Master of Science in Business Information Systems FHNW
Pre-Master Information Systems
3. Persistence Layer
Andreas Martin
3. Persistence Layer
http://www.flickr.com/photos/shandrew/3327258963
Andreas Martin - Page 2
Persistence Layer
 Object- Relational Mapping (ORM)
 Java Persistence API (JPA)
 Java Transaction API (JTA)
 Hands-on:
 Hands-on 1: JAVA PERSISTENCE
 Hands-on 2: MANAGING PERSISTENT OBJECTS
3. Persistence Layer
The Latte Macchiato «Layering» Principle
http://www.flickr.com/photos/tf28/4367660424
Presentation Layer
Goal: Display of information, processing /
forwarding of user interactions.
Technologies: JavaServer Faces (JSF), JavaServer
Pages (JSP), Servlets, etc.
Business (Logic) Layer
Goal: Reproduction of actions or «verbs» of the
application (buy a book, print an order, deliver a
book, etc.).
Technologies: Enterprise Java Beans (EJBs)
Persistence Layer
Goal: Reproduction of database attributes,
information or «nouns» in object / class attributes
(Object-Relational Mapping, ORM).
Technologies: Java Persistence API (JPA)
Object- Relational
Mapping (ORM)
http://www.flickr.com/photos/ellasdad/425813314
Andreas Martin - Page 5
JPA Specification at a Glance
 ORM: Mapping of java objects and database relations.
 Entity manager API: Database operations like: Create, Read,
Update, Delete (CRUD).
 Java Persistence Query Language (JPQL): Object oriented
query language.
 Java Transaction API (JTA): Transaction mechanism.
3. Persistence Layer
Source: Goncalves, 2010: Beginning Java™ EE 6 Platform with GlassFish™ 3 – Code (Apache-2.0 license): http://kenai.com/projects/beginningee6/
Andreas Martin - Page 6
Object-Relational Mapping (ORM)
3. Persistence Layer
Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
Andreas Martin - Page 7
Object-Relational Mapping (ORM)
 @Entity: declares a
database relation.
 @Id: defines the
primary key value(s).
 @GeneratedValue:
defines a value the will
be automatically
generated.
 @Column: can be used
to modify the standard
mapping behaviour.
3. Persistence Layer
Listing: A Simple Book Entity
@Entity
public class Book {
@Id @GeneratedValue
private Long id;
@Column(nullable = false)
private String title;
private Float price;
@Column(length = 2000)
private String description;
private String isbn;
private Integer nbOfPage;
private Boolean illustrations;
// Constructors, getters, setters
}
Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
Andreas Martin - Page 8
Simple Example of a Book Entity
3. Persistence Layer
Listing: Simple Example of a Book Entity
@Entity
public class Book {
@Id
@GeneratedValue(strategy =
GenerationType.AUTO)
private Long id;
private String title;
private Float price;
private String description;
private String isbn;
private Integer nbOfPage;
private Boolean illustrations;
public Book() {
}
// Getters, setters
}
Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
Andreas Martin - Page 9
Simple Example of a Book Entity
3. Persistence Layer
Listing: Simple Example of a Book Entity
@Entity
public class Book {
@Id
@GeneratedValue(strategy =
GenerationType.AUTO)
private Long id;
private String title;
private Float price;
private String description;
private String isbn;
private Integer nbOfPage;
private Boolean illustrations;
public Book() {
}
// Getters, setters
}
Listing: Structure of the BOOK
Table
CREATE TABLE BOOK (
ID BIGINT NOT NULL,
TITLE VARCHAR(255),
PRICE DOUBLE(52, 0),
DESCRIPTION VARCHAR(255),
ISBN VARCHAR(255),
NBOFPAGE INTEGER,
ILLUSTRATIONS SMALLINT,
PRIMARY KEY (ID)
);
Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
Andreas Martin - Page 10
Querying Entities using JPQL and EntityManager
3. Persistence Layer
EntityManagerFactory emf = Persistence.createEntityManagerFactory("primary");
EntityManager em = emf.createEntityManager();
em.persist(book);
 The methods
persist() and find()
will be transferred
by the
EntityManager into
JDBC calls (INSERT or
SELECT SQL
statements).
Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
Andreas Martin - Page 11
Listing: A findBookByTitle Named Query
@Entity
@NamedQuery(name = "findBookWithTitleJava", query = "SELECT b
FROM Book b WHERE b.title =‘Java'")
public class Book {
@Id @GeneratedValue
private Long id;
@Column(nullable = false)
private String title;
private Float price;
@Column(length = 2000)
private String description;
private String isbn;
private Integer nbOfPage;
private Boolean illustrations;
// Constructors, getters, setters
}
Querying Entities using JPQL and EntityManager
 Instead of using native SQL, it
is more sophisticated to use
JPQL:
 SELECT b FROM Book b
WHERE b.title = ‘Java‘;
 JPQL is similar to SQL, which adds
the object-point notation.
3. Persistence Layer
Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
Andreas Martin - Page 12
Hands-on-1
Java Persistence
3. Persistence Layer
Andreas Martin - Page 13
Predefined Projects - Hands-on Projects @ GitHub
…will be used for all the hands-on’s
1. First download “Hands-on Projects @ GitHub” ZIP- file from
Moodle and extract it into a folder.
2. Import predefined projects in Eclipse:
3. Persistence Layer
Andreas Martin - Page 14
Database Connection
…will be used for the next two hands-on’s
 Create or modify the persistence.xml file:
 Choose another student ‘number’
to avoid overwriting.
3. Persistence Layer
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="primary" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="hibernate.connection.username" value="premscis"/>
<property name="hibernate.connection.password" value="premscis"/>
<property name="hibernate.connection.url" value="jdbc:mysql://mature.iwi.wirtschaft.fhnw.ch:80/student0"/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
</properties>
</persistence-unit>
</persistence>
Andreas Martin - Page 15
Hands-on 1: Overview
 Now we know what an entity or the entity manager is.
 In this hands-on we are going to write a small application,
which stores an entity into a database.
 Create a Book entity and a Main class including a main
method, that stores a book entry into our MySQL database
(use the premscis scheme).
 Use the predefined maven project and watch out the pre-
configurations.
3. Persistence Layer
Andreas Martin - Page 16
Hands-on 1
1. Import (or create from blueprint) the hands-on-1 project. All
the source code will be placed into the
ch.fhnw.mscbis.premscis.handson1 package.
2. Create a Book entity with the following attributes: id,
title, price, description, isbn,
numberOfPages and illustrations. Choose the right
datatypes.
3. Generate Getter & Setter methods.
3. Persistence Layer
Andreas Martin - Page 17
Hands-on 1
4. Create a Main class and a main method where you create a
book.
3. Persistence Layer
// Create a book
EntityManagerFactory emf = Persistence.createEntityManagerFactory("primary");
EntityManager em = emf.createEntityManager();
EntityTransaction tx = em.getTransaction();
tx.begin();
em.persist(book);
tx.commit();
em.close();
emf.close();
Object- Relational
Mapping (ORM)
http://www.flickr.com/photos/ellasdad/425813314
@Annotations
Andreas Martin - Page 19
@Table
 @Table(name = ""): is used to
define the name of the
database table.
 Btw.:
@javax.persistence.Table
would be the full path to the
annotation, we can use the
short form in combination
with an include.
3. Persistence Layer
Listing: The Book Entity Being
Mapped to a T_BOOK Table
@Entity
@Table(name = "t_book")
public class Book {
@Id
private Long id;
private String title;
private Float price;
private String description;
private String isbn;
private Integer nbOfPage;
private Boolean illustrations;
public Book() {
}
// Getters and setters
}
Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
Andreas Martin - Page 20
@SecondaryTable
3. Persistence Layer
Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
Andreas Martin - Page 21
@SecondaryTable
3. Persistence Layer
Listing: Attributes of the Address Entity Mapped in Three Different Tables
@Entity
@SecondaryTables( {
@SecondaryTable(name = "city"),
@SecondaryTable(name = "country")
})
public class Address {
@Id
private Long id;
private String street1;
private String street2;
@Column(table = "city")
private String city;
@Column(table = "city")
private String state;
@Column(table = "city")
private String zipcode;
@Column(table = "country")
private String country;
// Constructors, getters, setters
}
Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
Andreas Martin - Page 22
Composite Primary Key using @EmbeddedId
3. Persistence Layer
Listing: DDL of the NEWS Table with a Composite Primary Key
create table NEWS (
CONTENT VARCHAR(255),
TITLE VARCHAR(255) not null,
LANGUAGE VARCHAR(255) not null,
primary key (TITLE, LANGUAGE)
);
Listing: The Entity Embeds the
Primary Key Class with @EmbeddedId
@Entity
public class News {
@EmbeddedId
private NewsId id;
private String content;
// …
}
Listing: The Primary Key Class Is
Annotated with @Embeddable
@Embeddable
public class NewsId {
private String title;
private String language;
// …
}
Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
Andreas Martin - Page 23
Relationship Mapping
3. Persistence Layer
Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
Annotation Direction
@OneToOne Unidirectional
@OneToOne Bidirectional
@OneToMany Unidirectional
@ManyToOne / @OneToMany Bidirectional
@ManyToOne Unidirectional
@ManyToMany Unidirectional
@ManyToMany Bidirectional
All possible mappings:
Andreas Martin - Page 24
@OneToOne
3. Persistence Layer
Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
Listing: The Customer Entity
@Entity
public class Customer {
@Id @GeneratedValue
private Long id;
private String firstName;
private String lastName;
private String email;
private String phoneNumber;
@OneToOne
@JoinColumn(name = "address_fk")
private Address address;
// Constructors, getters, setters
}
Listing: An Address Entity
@Entity
public class Address {
@Id @GeneratedValue
private Long id;
private String street1;
private String street2;
private String city;
private String state;
private String zipcode;
private String country;
@OneToOne(mappedBy = "address")
private Customer customer;
// Constructors, getters, setters
}
Andreas Martin - Page 25
@OneToMany Unidirectional
3. Persistence Layer
Listing: The Order Entity with a Join Column
@Entity
public class Order {
@Id @GeneratedValue
private Long id;
@Temporal(TemporalType.TIMESTAMP)
private Date creationDate;
@OneToMany(fetch = FetchType.EAGER)
@JoinColumn(name = "order_fk")
private List<OrderLine> orderLines;
// Constructors, getters, setters
}
Listing: An OrderLine
@Entity
@Table(name = "order_line")
public class OrderLine {
@Id @GeneratedValue
private Long id;
private String item;
private Double unitPrice;
private Integer quantity;
// Constructors, getters, setters
}
Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
Andreas Martin - Page 26
@ManyToMany Bidirectional – read & write
3. Persistence Layer
Listing: One Artist Appears on Several CD Albums
@Entity
public class Artist {
@Id @GeneratedValue
private Long id;
private String firstName;
private String lastName;
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "jnd_art_cd",
joinColumns = @JoinColumn(name = "artist_fk"),
inverseJoinColumns = @JoinColumn(name = "cd_fk"))
private List<CD> appearsOnCDs;
// Constructors, getters, setters
}
Listing: One CD is Created by Several Artists
@Entity
public class CD {
@Id @GeneratedValue
private Long id;
private String title;
private Float price;
private String description;
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "jnd_art_cd",
joinColumns = @JoinColumn(name = "cd_fk"),
inverseJoinColumns = @JoinColumn(name = "artist_fk"))
private List<Artist> createdByArtists;
// Constructors, getters, setters
}
Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
Andreas Martin - Page 27
Managing Persistent Objects
3. Persistence Layer
Andreas Martin - Page 28
Recap our Hands-on 1
3. Persistence Layer
Listing: A Main Class Persisting and Retrieving a Book Entity
public class Main {
public static void main(String[] args) {
// 1-Create an instance of the Book entity
Book book = new Book();
book.setId(1234L);
book.setTitle("The Hitchhiker's Guide to the Galaxy");
book.setPrice(12.5F);
book.setDescription("Science fiction created by Douglas Adams.");
book.setIsbn("1-84023-742-2");
book.setNbOfPage(354);
book.setIllustrations(false);
// 2-Get an entity manager and a transaction
EntityManagerFactory emf =
Persistence.createEntityManagerFactory(«primary");
EntityManager em = emf.createEntityManager();
EntityTransaction tx = em.getTransaction();
// 3-Persist the book to the database
tx.begin();
em.persist(book);
tx.commit();
// 4-Retrieve the book by its identifier
book = em.find(Book.class, 1234L);
System.out.println(book);
em.close();
emf.close();
}
}
Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
Andreas Martin - Page 29
Persisting an Entity
3. Persistence Layer
Listing: Persisting a Customer with an Address
EntityManager em = …;
Customer customer = new Customer("Antony", "Balla", "tballa@mail.com");
Address address = new Address("Ritherdon Rd", "London", "8QE", "UK");
customer.setAddress(address);
tx.begin();
em.persist(customer);
em.persist(address);
tx.commit();
assertNotNull(customer.getId());
assertNotNull(address.getId());
Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
Andreas Martin - Page 30
JPQL
3. Persistence Layer
Andreas Martin - Page 31
UPDATE <entity name> [[AS] <identification variable>]
SET <update statement> {, <update statement>}*
[WHERE <conditional expression>]
DELETE FROM <entity name> [[AS] <identification var.>]
[WHERE <conditional expression>]
JPQL
SELECT- Syntax
DELETE- Syntax
UPDATE- Syntax
 The JPQL syntax is
comparable to the SQL
syntax is used in a MySQL or
Apache Derby environment.
 Extensions in JPQL e.g.:
3. Persistence Layer
Source: Goncalves, 2010: Beginning Java™ EE 6 Platform with GlassFish™ 3 – Code (Apache-2.0 license): http://kenai.com/projects/beginningee6/
SELECT <expression>
FROM <clause>
[WHERE <conditional expression>]
[ORDER BY <clause>]
[GROUP BY <clause>]
[HAVING <clause>]
SELECT CASE b.author WHEN 'Martin'
THEN b.price * 1.5
ELSE b.price * 0.8
END
FROM Book b
Andreas Martin - Page 32
Named Queries
 Named Queries like Dynamic Queries:
Query query = em.createNamedQuery("findAll");
List<Customer> customers = query.getResultList();
 as Named Typed Query:
TypedQuery<Customer> query = em.createNamedQuery("findAll", Customer.class);
List<Customer> customers = query.getResultList();
 and including parameters
Query query = em.createNamedQuery("findWithParam");
query.setParameter("fname", "Vincent");
List<Customer> customers = query.getResultList();
3. Persistence Layer
Listing: The Customer Entity Defining Named Queries
@Entity
@NamedQueries( {
@NamedQuery(name = "findAll", query="select c from Customer c"),
@NamedQuery(name = "findVincent", query="select c from Customer c where c.firstName
= 'Vincent'"),
@NamedQuery(name = "findWithParam", query="select c from Customer c where
c.firstName = :fname") })
public class Customer {
@Id @GeneratedValue
private Long id;
private String firstName; /* etc. */ }
Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
Andreas Martin - Page 33
Hands-on 2
MANAGING PERSISTENT OBJECTS
3. Persistence Layer
Based on: Goncalves, 2010: Beginning Java™ EE 6 Platform with GlassFish™ 3
Andreas Martin - Page 34
Hands-on 2
1. Import the «hands-on-2» project.
2. Create the following entities: Address and Customer
 Fields of Address: id, street1, city, zipcode und country.
 Fields of Customer: id, firstName, lastName, email und address.
 Please give the entities a unique table name.
3. Write a main method in a Main class and enter some data
into the database.
3. Persistence Layer

Más contenido relacionado

La actualidad más candente

Java interview questions and answers
Java interview questions and answersJava interview questions and answers
Java interview questions and answersKrishnaov
 
Entity Framework: Code First and Magic Unicorns
Entity Framework: Code First and Magic UnicornsEntity Framework: Code First and Magic Unicorns
Entity Framework: Code First and Magic UnicornsRichie Rump
 
Complex Data Binding
Complex Data BindingComplex Data Binding
Complex Data BindingDoncho Minkov
 
Hibernate Developer Reference
Hibernate Developer ReferenceHibernate Developer Reference
Hibernate Developer ReferenceMuthuselvam RS
 
MCS,BCS-7(A,B) Visual programming Syllabus for Final exams @ ISP
MCS,BCS-7(A,B) Visual programming Syllabus for Final exams @ ISPMCS,BCS-7(A,B) Visual programming Syllabus for Final exams @ ISP
MCS,BCS-7(A,B) Visual programming Syllabus for Final exams @ ISPAli Shah
 
Hibernate Tutorial
Hibernate TutorialHibernate Tutorial
Hibernate TutorialSyed Shahul
 
Lotusphere 2007 BP301 Advanced Object Oriented Programming for LotusScript
Lotusphere 2007 BP301 Advanced Object Oriented Programming for LotusScriptLotusphere 2007 BP301 Advanced Object Oriented Programming for LotusScript
Lotusphere 2007 BP301 Advanced Object Oriented Programming for LotusScriptBill Buchan
 
Poject documentation deepak
Poject documentation deepakPoject documentation deepak
Poject documentation deepakchetankane
 
Ado.net session04
Ado.net session04Ado.net session04
Ado.net session04Niit Care
 
Entity Framework: Nakov @ BFU Hackhaton 2015
Entity Framework: Nakov @ BFU Hackhaton 2015Entity Framework: Nakov @ BFU Hackhaton 2015
Entity Framework: Nakov @ BFU Hackhaton 2015Svetlin Nakov
 

La actualidad más candente (20)

Java interview questions and answers
Java interview questions and answersJava interview questions and answers
Java interview questions and answers
 
Jdbc api
Jdbc apiJdbc api
Jdbc api
 
Schema webinar
Schema webinarSchema webinar
Schema webinar
 
Schema201 webinar
Schema201 webinarSchema201 webinar
Schema201 webinar
 
Entity Framework: Code First and Magic Unicorns
Entity Framework: Code First and Magic UnicornsEntity Framework: Code First and Magic Unicorns
Entity Framework: Code First and Magic Unicorns
 
Hibernate Advance Interview Questions
Hibernate Advance Interview QuestionsHibernate Advance Interview Questions
Hibernate Advance Interview Questions
 
Complex Data Binding
Complex Data BindingComplex Data Binding
Complex Data Binding
 
Introduction to JPA Framework
Introduction to JPA FrameworkIntroduction to JPA Framework
Introduction to JPA Framework
 
Getting started with entity framework
Getting started with entity framework Getting started with entity framework
Getting started with entity framework
 
Hibernate Developer Reference
Hibernate Developer ReferenceHibernate Developer Reference
Hibernate Developer Reference
 
MCS,BCS-7(A,B) Visual programming Syllabus for Final exams @ ISP
MCS,BCS-7(A,B) Visual programming Syllabus for Final exams @ ISPMCS,BCS-7(A,B) Visual programming Syllabus for Final exams @ ISP
MCS,BCS-7(A,B) Visual programming Syllabus for Final exams @ ISP
 
Hibernate Tutorial
Hibernate TutorialHibernate Tutorial
Hibernate Tutorial
 
Mvc acchitecture
Mvc acchitectureMvc acchitecture
Mvc acchitecture
 
Lotusphere 2007 BP301 Advanced Object Oriented Programming for LotusScript
Lotusphere 2007 BP301 Advanced Object Oriented Programming for LotusScriptLotusphere 2007 BP301 Advanced Object Oriented Programming for LotusScript
Lotusphere 2007 BP301 Advanced Object Oriented Programming for LotusScript
 
JDBC – Java Database Connectivity
JDBC – Java Database ConnectivityJDBC – Java Database Connectivity
JDBC – Java Database Connectivity
 
hibernate with JPA
hibernate with JPAhibernate with JPA
hibernate with JPA
 
Poject documentation deepak
Poject documentation deepakPoject documentation deepak
Poject documentation deepak
 
Ado.net session04
Ado.net session04Ado.net session04
Ado.net session04
 
Mallet
MalletMallet
Mallet
 
Entity Framework: Nakov @ BFU Hackhaton 2015
Entity Framework: Nakov @ BFU Hackhaton 2015Entity Framework: Nakov @ BFU Hackhaton 2015
Entity Framework: Nakov @ BFU Hackhaton 2015
 

Destacado

La revolución digital: tendencias en los medios y en la publicidad | Víctor K...
La revolución digital: tendencias en los medios y en la publicidad | Víctor K...La revolución digital: tendencias en los medios y en la publicidad | Víctor K...
La revolución digital: tendencias en los medios y en la publicidad | Víctor K...EBEDominicana
 
Energy And Natural Resources, Energy News, Natural Resources, Solar Power
Energy And Natural Resources, Energy News, Natural Resources, Solar Power Energy And Natural Resources, Energy News, Natural Resources, Solar Power
Energy And Natural Resources, Energy News, Natural Resources, Solar Power Corp LiveWire
 
An Integrated Management Supervisor for End-to-End Management of Heterogeneou...
An Integrated Management Supervisor for End-to-End Management of Heterogeneou...An Integrated Management Supervisor for End-to-End Management of Heterogeneou...
An Integrated Management Supervisor for End-to-End Management of Heterogeneou...Alpen-Adria-Universität
 
Planes de negocios
Planes de negociosPlanes de negocios
Planes de negociosgiacop19
 
ViSalus Policies Procedures UK 2013
ViSalus Policies Procedures UK 2013ViSalus Policies Procedures UK 2013
ViSalus Policies Procedures UK 2013ViSalus Shakes
 
Presentación actividades de formación 2014 2015-1
Presentación actividades de formación 2014 2015-1Presentación actividades de formación 2014 2015-1
Presentación actividades de formación 2014 2015-1CPR Oviedo
 
Native Advertising at Scale
Native Advertising at ScaleNative Advertising at Scale
Native Advertising at ScaleMatt O'Neill
 
Putera Sampoerna Foundation Report Quarter 1 2009
Putera Sampoerna Foundation Report Quarter 1 2009Putera Sampoerna Foundation Report Quarter 1 2009
Putera Sampoerna Foundation Report Quarter 1 2009Putera Sampoerna Foundation
 
BIBLIA CATOLICA, NUEVO TESTAMENTO, CARTAS DE JUAN, PARTE 23 DE 27
BIBLIA CATOLICA, NUEVO TESTAMENTO, CARTAS DE JUAN, PARTE 23 DE 27BIBLIA CATOLICA, NUEVO TESTAMENTO, CARTAS DE JUAN, PARTE 23 DE 27
BIBLIA CATOLICA, NUEVO TESTAMENTO, CARTAS DE JUAN, PARTE 23 DE 27sifexol
 
Jiri_Ptacek_Blackbelt_Case_study_Certified
Jiri_Ptacek_Blackbelt_Case_study_CertifiedJiri_Ptacek_Blackbelt_Case_study_Certified
Jiri_Ptacek_Blackbelt_Case_study_CertifiedJiri Ptacek
 
Guía dental SANITAS Barcelona 2013
Guía dental SANITAS Barcelona 2013Guía dental SANITAS Barcelona 2013
Guía dental SANITAS Barcelona 2013Comercial-APPSalud
 
자동인식&스마트SCM(MONTHLY AIDC+SMART SCM) 2013년 2월호
자동인식&스마트SCM(MONTHLY AIDC+SMART SCM) 2013년 2월호자동인식&스마트SCM(MONTHLY AIDC+SMART SCM) 2013년 2월호
자동인식&스마트SCM(MONTHLY AIDC+SMART SCM) 2013년 2월호고양뉴스
 
Politica2.cero: Pablo Iglesias, email marketing en "Estrategias de Engagement...
Politica2.cero: Pablo Iglesias, email marketing en "Estrategias de Engagement...Politica2.cero: Pablo Iglesias, email marketing en "Estrategias de Engagement...
Politica2.cero: Pablo Iglesias, email marketing en "Estrategias de Engagement...Candedo
 
Exposicon formacion critica
Exposicon formacion criticaExposicon formacion critica
Exposicon formacion criticaNicksonxD
 
EY Global Market Outlook 2016 - Trends in Real Estate Private Equity
EY Global Market Outlook 2016 - Trends in Real Estate Private EquityEY Global Market Outlook 2016 - Trends in Real Estate Private Equity
EY Global Market Outlook 2016 - Trends in Real Estate Private EquityThorsten Lederer 托尔斯滕
 

Destacado (20)

La revolución digital: tendencias en los medios y en la publicidad | Víctor K...
La revolución digital: tendencias en los medios y en la publicidad | Víctor K...La revolución digital: tendencias en los medios y en la publicidad | Víctor K...
La revolución digital: tendencias en los medios y en la publicidad | Víctor K...
 
Directorios para pyme
Directorios para pymeDirectorios para pyme
Directorios para pyme
 
Energy And Natural Resources, Energy News, Natural Resources, Solar Power
Energy And Natural Resources, Energy News, Natural Resources, Solar Power Energy And Natural Resources, Energy News, Natural Resources, Solar Power
Energy And Natural Resources, Energy News, Natural Resources, Solar Power
 
Partes de-un-celular
Partes de-un-celularPartes de-un-celular
Partes de-un-celular
 
An Integrated Management Supervisor for End-to-End Management of Heterogeneou...
An Integrated Management Supervisor for End-to-End Management of Heterogeneou...An Integrated Management Supervisor for End-to-End Management of Heterogeneou...
An Integrated Management Supervisor for End-to-End Management of Heterogeneou...
 
Club de beneficios Patria Quemera
Club de beneficios Patria QuemeraClub de beneficios Patria Quemera
Club de beneficios Patria Quemera
 
Planes de negocios
Planes de negociosPlanes de negocios
Planes de negocios
 
IC 2010 Info Pack
IC 2010 Info PackIC 2010 Info Pack
IC 2010 Info Pack
 
ViSalus Policies Procedures UK 2013
ViSalus Policies Procedures UK 2013ViSalus Policies Procedures UK 2013
ViSalus Policies Procedures UK 2013
 
Presentación actividades de formación 2014 2015-1
Presentación actividades de formación 2014 2015-1Presentación actividades de formación 2014 2015-1
Presentación actividades de formación 2014 2015-1
 
Native Advertising at Scale
Native Advertising at ScaleNative Advertising at Scale
Native Advertising at Scale
 
Putera Sampoerna Foundation Report Quarter 1 2009
Putera Sampoerna Foundation Report Quarter 1 2009Putera Sampoerna Foundation Report Quarter 1 2009
Putera Sampoerna Foundation Report Quarter 1 2009
 
BIBLIA CATOLICA, NUEVO TESTAMENTO, CARTAS DE JUAN, PARTE 23 DE 27
BIBLIA CATOLICA, NUEVO TESTAMENTO, CARTAS DE JUAN, PARTE 23 DE 27BIBLIA CATOLICA, NUEVO TESTAMENTO, CARTAS DE JUAN, PARTE 23 DE 27
BIBLIA CATOLICA, NUEVO TESTAMENTO, CARTAS DE JUAN, PARTE 23 DE 27
 
Jiri_Ptacek_Blackbelt_Case_study_Certified
Jiri_Ptacek_Blackbelt_Case_study_CertifiedJiri_Ptacek_Blackbelt_Case_study_Certified
Jiri_Ptacek_Blackbelt_Case_study_Certified
 
Guía dental SANITAS Barcelona 2013
Guía dental SANITAS Barcelona 2013Guía dental SANITAS Barcelona 2013
Guía dental SANITAS Barcelona 2013
 
자동인식&스마트SCM(MONTHLY AIDC+SMART SCM) 2013년 2월호
자동인식&스마트SCM(MONTHLY AIDC+SMART SCM) 2013년 2월호자동인식&스마트SCM(MONTHLY AIDC+SMART SCM) 2013년 2월호
자동인식&스마트SCM(MONTHLY AIDC+SMART SCM) 2013년 2월호
 
Ge presentación grupo 4
Ge presentación grupo 4Ge presentación grupo 4
Ge presentación grupo 4
 
Politica2.cero: Pablo Iglesias, email marketing en "Estrategias de Engagement...
Politica2.cero: Pablo Iglesias, email marketing en "Estrategias de Engagement...Politica2.cero: Pablo Iglesias, email marketing en "Estrategias de Engagement...
Politica2.cero: Pablo Iglesias, email marketing en "Estrategias de Engagement...
 
Exposicon formacion critica
Exposicon formacion criticaExposicon formacion critica
Exposicon formacion critica
 
EY Global Market Outlook 2016 - Trends in Real Estate Private Equity
EY Global Market Outlook 2016 - Trends in Real Estate Private EquityEY Global Market Outlook 2016 - Trends in Real Estate Private Equity
EY Global Market Outlook 2016 - Trends in Real Estate Private Equity
 

Similar a 2014 Pre-MSc-IS-3 Persistence Layer

Ejb3 Struts Tutorial En
Ejb3 Struts Tutorial EnEjb3 Struts Tutorial En
Ejb3 Struts Tutorial EnAnkur Dongre
 
Ejb3 Struts Tutorial En
Ejb3 Struts Tutorial EnEjb3 Struts Tutorial En
Ejb3 Struts Tutorial EnAnkur Dongre
 
Hibernate An Introduction
Hibernate An IntroductionHibernate An Introduction
Hibernate An IntroductionNguyen Cao
 
Patni Hibernate
Patni   HibernatePatni   Hibernate
Patni Hibernatepatinijava
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)CODE WHITE GmbH
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller ColumnsJonathan Fine
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2wiradikusuma
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug ClassJava Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug ClassCODE WHITE GmbH
 
Rails and alternative ORMs
Rails and alternative ORMsRails and alternative ORMs
Rails and alternative ORMsJonathan Dahl
 
2014 Pre-MSc-IS-4 Business Logic Layer
2014 Pre-MSc-IS-4 Business Logic Layer2014 Pre-MSc-IS-4 Business Logic Layer
2014 Pre-MSc-IS-4 Business Logic Layerandreasmartin
 
Advanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sirAdvanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sirAVINASH KUMAR
 
Assignment Examples Final 07 Oct
Assignment Examples Final 07 OctAssignment Examples Final 07 Oct
Assignment Examples Final 07 OctSriram Raj
 
Krazykoder struts2 spring_hibernate
Krazykoder struts2 spring_hibernateKrazykoder struts2 spring_hibernate
Krazykoder struts2 spring_hibernateKrazy Koder
 
Struts database access
Struts database accessStruts database access
Struts database accessAbass Ndiaye
 

Similar a 2014 Pre-MSc-IS-3 Persistence Layer (20)

Ejb3 Struts Tutorial En
Ejb3 Struts Tutorial EnEjb3 Struts Tutorial En
Ejb3 Struts Tutorial En
 
Ejb3 Struts Tutorial En
Ejb3 Struts Tutorial EnEjb3 Struts Tutorial En
Ejb3 Struts Tutorial En
 
Hibernate An Introduction
Hibernate An IntroductionHibernate An Introduction
Hibernate An Introduction
 
Patni Hibernate
Patni   HibernatePatni   Hibernate
Patni Hibernate
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
 
backend
backendbackend
backend
 
backend
backendbackend
backend
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller Columns
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug ClassJava Deserialization Vulnerabilities - The Forgotten Bug Class
Java Deserialization Vulnerabilities - The Forgotten Bug Class
 
Rails and alternative ORMs
Rails and alternative ORMsRails and alternative ORMs
Rails and alternative ORMs
 
2014 Pre-MSc-IS-4 Business Logic Layer
2014 Pre-MSc-IS-4 Business Logic Layer2014 Pre-MSc-IS-4 Business Logic Layer
2014 Pre-MSc-IS-4 Business Logic Layer
 
Lift Framework
Lift FrameworkLift Framework
Lift Framework
 
Java scriptforjavadev part2a
Java scriptforjavadev part2aJava scriptforjavadev part2a
Java scriptforjavadev part2a
 
Advanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sirAdvanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sir
 
Prg421
Prg421Prg421
Prg421
 
Assignment Examples Final 07 Oct
Assignment Examples Final 07 OctAssignment Examples Final 07 Oct
Assignment Examples Final 07 Oct
 
Krazykoder struts2 spring_hibernate
Krazykoder struts2 spring_hibernateKrazykoder struts2 spring_hibernate
Krazykoder struts2 spring_hibernate
 
Struts database access
Struts database accessStruts database access
Struts database access
 
Reversing JavaScript
Reversing JavaScriptReversing JavaScript
Reversing JavaScript
 

Más de andreasmartin

A Case Modelling Language for Process Variant Management in Case-based Reasoning
A Case Modelling Language for Process Variant Management in Case-based ReasoningA Case Modelling Language for Process Variant Management in Case-based Reasoning
A Case Modelling Language for Process Variant Management in Case-based Reasoningandreasmartin
 
2014 Pre-MSc-IS-6 Presentation Layer
2014 Pre-MSc-IS-6 Presentation Layer2014 Pre-MSc-IS-6 Presentation Layer
2014 Pre-MSc-IS-6 Presentation Layerandreasmartin
 
2014 Pre-MSc-IS-5 Process Layer
2014 Pre-MSc-IS-5 Process Layer2014 Pre-MSc-IS-5 Process Layer
2014 Pre-MSc-IS-5 Process Layerandreasmartin
 
2014 Pre-MSc-IS-2 Infrastructure
2014 Pre-MSc-IS-2 Infrastructure2014 Pre-MSc-IS-2 Infrastructure
2014 Pre-MSc-IS-2 Infrastructureandreasmartin
 
2014 Pre-MSc-IS-1 Java Enterprise Edition and Information Systems Layering
2014 Pre-MSc-IS-1 Java Enterprise Edition and Information Systems Layering2014 Pre-MSc-IS-1 Java Enterprise Edition and Information Systems Layering
2014 Pre-MSc-IS-1 Java Enterprise Edition and Information Systems Layeringandreasmartin
 
2014 Pre-MSc-IS-0 Information Systems Modelling and Design
2014 Pre-MSc-IS-0 Information Systems Modelling and Design2014 Pre-MSc-IS-0 Information Systems Modelling and Design
2014 Pre-MSc-IS-0 Information Systems Modelling and Designandreasmartin
 
Integrating an Enterprise Architecture Ontology in a Case-based Reasoning App...
Integrating an Enterprise Architecture Ontology in a Case-based Reasoning App...Integrating an Enterprise Architecture Ontology in a Case-based Reasoning App...
Integrating an Enterprise Architecture Ontology in a Case-based Reasoning App...andreasmartin
 

Más de andreasmartin (7)

A Case Modelling Language for Process Variant Management in Case-based Reasoning
A Case Modelling Language for Process Variant Management in Case-based ReasoningA Case Modelling Language for Process Variant Management in Case-based Reasoning
A Case Modelling Language for Process Variant Management in Case-based Reasoning
 
2014 Pre-MSc-IS-6 Presentation Layer
2014 Pre-MSc-IS-6 Presentation Layer2014 Pre-MSc-IS-6 Presentation Layer
2014 Pre-MSc-IS-6 Presentation Layer
 
2014 Pre-MSc-IS-5 Process Layer
2014 Pre-MSc-IS-5 Process Layer2014 Pre-MSc-IS-5 Process Layer
2014 Pre-MSc-IS-5 Process Layer
 
2014 Pre-MSc-IS-2 Infrastructure
2014 Pre-MSc-IS-2 Infrastructure2014 Pre-MSc-IS-2 Infrastructure
2014 Pre-MSc-IS-2 Infrastructure
 
2014 Pre-MSc-IS-1 Java Enterprise Edition and Information Systems Layering
2014 Pre-MSc-IS-1 Java Enterprise Edition and Information Systems Layering2014 Pre-MSc-IS-1 Java Enterprise Edition and Information Systems Layering
2014 Pre-MSc-IS-1 Java Enterprise Edition and Information Systems Layering
 
2014 Pre-MSc-IS-0 Information Systems Modelling and Design
2014 Pre-MSc-IS-0 Information Systems Modelling and Design2014 Pre-MSc-IS-0 Information Systems Modelling and Design
2014 Pre-MSc-IS-0 Information Systems Modelling and Design
 
Integrating an Enterprise Architecture Ontology in a Case-based Reasoning App...
Integrating an Enterprise Architecture Ontology in a Case-based Reasoning App...Integrating an Enterprise Architecture Ontology in a Case-based Reasoning App...
Integrating an Enterprise Architecture Ontology in a Case-based Reasoning App...
 

Último

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 

Último (20)

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 

2014 Pre-MSc-IS-3 Persistence Layer

  • 1. Andreas Martin - Page 1 Master of Science in Business Information Systems FHNW Pre-Master Information Systems 3. Persistence Layer Andreas Martin 3. Persistence Layer http://www.flickr.com/photos/shandrew/3327258963
  • 2. Andreas Martin - Page 2 Persistence Layer  Object- Relational Mapping (ORM)  Java Persistence API (JPA)  Java Transaction API (JTA)  Hands-on:  Hands-on 1: JAVA PERSISTENCE  Hands-on 2: MANAGING PERSISTENT OBJECTS 3. Persistence Layer
  • 3. The Latte Macchiato «Layering» Principle http://www.flickr.com/photos/tf28/4367660424 Presentation Layer Goal: Display of information, processing / forwarding of user interactions. Technologies: JavaServer Faces (JSF), JavaServer Pages (JSP), Servlets, etc. Business (Logic) Layer Goal: Reproduction of actions or «verbs» of the application (buy a book, print an order, deliver a book, etc.). Technologies: Enterprise Java Beans (EJBs) Persistence Layer Goal: Reproduction of database attributes, information or «nouns» in object / class attributes (Object-Relational Mapping, ORM). Technologies: Java Persistence API (JPA)
  • 5. Andreas Martin - Page 5 JPA Specification at a Glance  ORM: Mapping of java objects and database relations.  Entity manager API: Database operations like: Create, Read, Update, Delete (CRUD).  Java Persistence Query Language (JPQL): Object oriented query language.  Java Transaction API (JTA): Transaction mechanism. 3. Persistence Layer Source: Goncalves, 2010: Beginning Java™ EE 6 Platform with GlassFish™ 3 – Code (Apache-2.0 license): http://kenai.com/projects/beginningee6/
  • 6. Andreas Martin - Page 6 Object-Relational Mapping (ORM) 3. Persistence Layer Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
  • 7. Andreas Martin - Page 7 Object-Relational Mapping (ORM)  @Entity: declares a database relation.  @Id: defines the primary key value(s).  @GeneratedValue: defines a value the will be automatically generated.  @Column: can be used to modify the standard mapping behaviour. 3. Persistence Layer Listing: A Simple Book Entity @Entity public class Book { @Id @GeneratedValue private Long id; @Column(nullable = false) private String title; private Float price; @Column(length = 2000) private String description; private String isbn; private Integer nbOfPage; private Boolean illustrations; // Constructors, getters, setters } Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
  • 8. Andreas Martin - Page 8 Simple Example of a Book Entity 3. Persistence Layer Listing: Simple Example of a Book Entity @Entity public class Book { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String title; private Float price; private String description; private String isbn; private Integer nbOfPage; private Boolean illustrations; public Book() { } // Getters, setters } Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
  • 9. Andreas Martin - Page 9 Simple Example of a Book Entity 3. Persistence Layer Listing: Simple Example of a Book Entity @Entity public class Book { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String title; private Float price; private String description; private String isbn; private Integer nbOfPage; private Boolean illustrations; public Book() { } // Getters, setters } Listing: Structure of the BOOK Table CREATE TABLE BOOK ( ID BIGINT NOT NULL, TITLE VARCHAR(255), PRICE DOUBLE(52, 0), DESCRIPTION VARCHAR(255), ISBN VARCHAR(255), NBOFPAGE INTEGER, ILLUSTRATIONS SMALLINT, PRIMARY KEY (ID) ); Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
  • 10. Andreas Martin - Page 10 Querying Entities using JPQL and EntityManager 3. Persistence Layer EntityManagerFactory emf = Persistence.createEntityManagerFactory("primary"); EntityManager em = emf.createEntityManager(); em.persist(book);  The methods persist() and find() will be transferred by the EntityManager into JDBC calls (INSERT or SELECT SQL statements). Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
  • 11. Andreas Martin - Page 11 Listing: A findBookByTitle Named Query @Entity @NamedQuery(name = "findBookWithTitleJava", query = "SELECT b FROM Book b WHERE b.title =‘Java'") public class Book { @Id @GeneratedValue private Long id; @Column(nullable = false) private String title; private Float price; @Column(length = 2000) private String description; private String isbn; private Integer nbOfPage; private Boolean illustrations; // Constructors, getters, setters } Querying Entities using JPQL and EntityManager  Instead of using native SQL, it is more sophisticated to use JPQL:  SELECT b FROM Book b WHERE b.title = ‘Java‘;  JPQL is similar to SQL, which adds the object-point notation. 3. Persistence Layer Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
  • 12. Andreas Martin - Page 12 Hands-on-1 Java Persistence 3. Persistence Layer
  • 13. Andreas Martin - Page 13 Predefined Projects - Hands-on Projects @ GitHub …will be used for all the hands-on’s 1. First download “Hands-on Projects @ GitHub” ZIP- file from Moodle and extract it into a folder. 2. Import predefined projects in Eclipse: 3. Persistence Layer
  • 14. Andreas Martin - Page 14 Database Connection …will be used for the next two hands-on’s  Create or modify the persistence.xml file:  Choose another student ‘number’ to avoid overwriting. 3. Persistence Layer <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="primary" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <property name="hibernate.connection.username" value="premscis"/> <property name="hibernate.connection.password" value="premscis"/> <property name="hibernate.connection.url" value="jdbc:mysql://mature.iwi.wirtschaft.fhnw.ch:80/student0"/> <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/> <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/> <property name="hibernate.hbm2ddl.auto" value="update"/> </properties> </persistence-unit> </persistence>
  • 15. Andreas Martin - Page 15 Hands-on 1: Overview  Now we know what an entity or the entity manager is.  In this hands-on we are going to write a small application, which stores an entity into a database.  Create a Book entity and a Main class including a main method, that stores a book entry into our MySQL database (use the premscis scheme).  Use the predefined maven project and watch out the pre- configurations. 3. Persistence Layer
  • 16. Andreas Martin - Page 16 Hands-on 1 1. Import (or create from blueprint) the hands-on-1 project. All the source code will be placed into the ch.fhnw.mscbis.premscis.handson1 package. 2. Create a Book entity with the following attributes: id, title, price, description, isbn, numberOfPages and illustrations. Choose the right datatypes. 3. Generate Getter & Setter methods. 3. Persistence Layer
  • 17. Andreas Martin - Page 17 Hands-on 1 4. Create a Main class and a main method where you create a book. 3. Persistence Layer // Create a book EntityManagerFactory emf = Persistence.createEntityManagerFactory("primary"); EntityManager em = emf.createEntityManager(); EntityTransaction tx = em.getTransaction(); tx.begin(); em.persist(book); tx.commit(); em.close(); emf.close();
  • 19. Andreas Martin - Page 19 @Table  @Table(name = ""): is used to define the name of the database table.  Btw.: @javax.persistence.Table would be the full path to the annotation, we can use the short form in combination with an include. 3. Persistence Layer Listing: The Book Entity Being Mapped to a T_BOOK Table @Entity @Table(name = "t_book") public class Book { @Id private Long id; private String title; private Float price; private String description; private String isbn; private Integer nbOfPage; private Boolean illustrations; public Book() { } // Getters and setters } Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
  • 20. Andreas Martin - Page 20 @SecondaryTable 3. Persistence Layer Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
  • 21. Andreas Martin - Page 21 @SecondaryTable 3. Persistence Layer Listing: Attributes of the Address Entity Mapped in Three Different Tables @Entity @SecondaryTables( { @SecondaryTable(name = "city"), @SecondaryTable(name = "country") }) public class Address { @Id private Long id; private String street1; private String street2; @Column(table = "city") private String city; @Column(table = "city") private String state; @Column(table = "city") private String zipcode; @Column(table = "country") private String country; // Constructors, getters, setters } Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
  • 22. Andreas Martin - Page 22 Composite Primary Key using @EmbeddedId 3. Persistence Layer Listing: DDL of the NEWS Table with a Composite Primary Key create table NEWS ( CONTENT VARCHAR(255), TITLE VARCHAR(255) not null, LANGUAGE VARCHAR(255) not null, primary key (TITLE, LANGUAGE) ); Listing: The Entity Embeds the Primary Key Class with @EmbeddedId @Entity public class News { @EmbeddedId private NewsId id; private String content; // … } Listing: The Primary Key Class Is Annotated with @Embeddable @Embeddable public class NewsId { private String title; private String language; // … } Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
  • 23. Andreas Martin - Page 23 Relationship Mapping 3. Persistence Layer Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7 Annotation Direction @OneToOne Unidirectional @OneToOne Bidirectional @OneToMany Unidirectional @ManyToOne / @OneToMany Bidirectional @ManyToOne Unidirectional @ManyToMany Unidirectional @ManyToMany Bidirectional All possible mappings:
  • 24. Andreas Martin - Page 24 @OneToOne 3. Persistence Layer Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7 Listing: The Customer Entity @Entity public class Customer { @Id @GeneratedValue private Long id; private String firstName; private String lastName; private String email; private String phoneNumber; @OneToOne @JoinColumn(name = "address_fk") private Address address; // Constructors, getters, setters } Listing: An Address Entity @Entity public class Address { @Id @GeneratedValue private Long id; private String street1; private String street2; private String city; private String state; private String zipcode; private String country; @OneToOne(mappedBy = "address") private Customer customer; // Constructors, getters, setters }
  • 25. Andreas Martin - Page 25 @OneToMany Unidirectional 3. Persistence Layer Listing: The Order Entity with a Join Column @Entity public class Order { @Id @GeneratedValue private Long id; @Temporal(TemporalType.TIMESTAMP) private Date creationDate; @OneToMany(fetch = FetchType.EAGER) @JoinColumn(name = "order_fk") private List<OrderLine> orderLines; // Constructors, getters, setters } Listing: An OrderLine @Entity @Table(name = "order_line") public class OrderLine { @Id @GeneratedValue private Long id; private String item; private Double unitPrice; private Integer quantity; // Constructors, getters, setters } Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
  • 26. Andreas Martin - Page 26 @ManyToMany Bidirectional – read & write 3. Persistence Layer Listing: One Artist Appears on Several CD Albums @Entity public class Artist { @Id @GeneratedValue private Long id; private String firstName; private String lastName; @ManyToMany(cascade = CascadeType.ALL) @JoinTable(name = "jnd_art_cd", joinColumns = @JoinColumn(name = "artist_fk"), inverseJoinColumns = @JoinColumn(name = "cd_fk")) private List<CD> appearsOnCDs; // Constructors, getters, setters } Listing: One CD is Created by Several Artists @Entity public class CD { @Id @GeneratedValue private Long id; private String title; private Float price; private String description; @ManyToMany(cascade = CascadeType.ALL) @JoinTable(name = "jnd_art_cd", joinColumns = @JoinColumn(name = "cd_fk"), inverseJoinColumns = @JoinColumn(name = "artist_fk")) private List<Artist> createdByArtists; // Constructors, getters, setters } Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
  • 27. Andreas Martin - Page 27 Managing Persistent Objects 3. Persistence Layer
  • 28. Andreas Martin - Page 28 Recap our Hands-on 1 3. Persistence Layer Listing: A Main Class Persisting and Retrieving a Book Entity public class Main { public static void main(String[] args) { // 1-Create an instance of the Book entity Book book = new Book(); book.setId(1234L); book.setTitle("The Hitchhiker's Guide to the Galaxy"); book.setPrice(12.5F); book.setDescription("Science fiction created by Douglas Adams."); book.setIsbn("1-84023-742-2"); book.setNbOfPage(354); book.setIllustrations(false); // 2-Get an entity manager and a transaction EntityManagerFactory emf = Persistence.createEntityManagerFactory(«primary"); EntityManager em = emf.createEntityManager(); EntityTransaction tx = em.getTransaction(); // 3-Persist the book to the database tx.begin(); em.persist(book); tx.commit(); // 4-Retrieve the book by its identifier book = em.find(Book.class, 1234L); System.out.println(book); em.close(); emf.close(); } } Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
  • 29. Andreas Martin - Page 29 Persisting an Entity 3. Persistence Layer Listing: Persisting a Customer with an Address EntityManager em = …; Customer customer = new Customer("Antony", "Balla", "tballa@mail.com"); Address address = new Address("Ritherdon Rd", "London", "8QE", "UK"); customer.setAddress(address); tx.begin(); em.persist(customer); em.persist(address); tx.commit(); assertNotNull(customer.getId()); assertNotNull(address.getId()); Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
  • 30. Andreas Martin - Page 30 JPQL 3. Persistence Layer
  • 31. Andreas Martin - Page 31 UPDATE <entity name> [[AS] <identification variable>] SET <update statement> {, <update statement>}* [WHERE <conditional expression>] DELETE FROM <entity name> [[AS] <identification var.>] [WHERE <conditional expression>] JPQL SELECT- Syntax DELETE- Syntax UPDATE- Syntax  The JPQL syntax is comparable to the SQL syntax is used in a MySQL or Apache Derby environment.  Extensions in JPQL e.g.: 3. Persistence Layer Source: Goncalves, 2010: Beginning Java™ EE 6 Platform with GlassFish™ 3 – Code (Apache-2.0 license): http://kenai.com/projects/beginningee6/ SELECT <expression> FROM <clause> [WHERE <conditional expression>] [ORDER BY <clause>] [GROUP BY <clause>] [HAVING <clause>] SELECT CASE b.author WHEN 'Martin' THEN b.price * 1.5 ELSE b.price * 0.8 END FROM Book b
  • 32. Andreas Martin - Page 32 Named Queries  Named Queries like Dynamic Queries: Query query = em.createNamedQuery("findAll"); List<Customer> customers = query.getResultList();  as Named Typed Query: TypedQuery<Customer> query = em.createNamedQuery("findAll", Customer.class); List<Customer> customers = query.getResultList();  and including parameters Query query = em.createNamedQuery("findWithParam"); query.setParameter("fname", "Vincent"); List<Customer> customers = query.getResultList(); 3. Persistence Layer Listing: The Customer Entity Defining Named Queries @Entity @NamedQueries( { @NamedQuery(name = "findAll", query="select c from Customer c"), @NamedQuery(name = "findVincent", query="select c from Customer c where c.firstName = 'Vincent'"), @NamedQuery(name = "findWithParam", query="select c from Customer c where c.firstName = :fname") }) public class Customer { @Id @GeneratedValue private Long id; private String firstName; /* etc. */ } Adapted from: Goncalves: Code and Models licensed under a CC BY-SA 3.0 License from https://github.com/agoncal/agoncal-book-javaee7
  • 33. Andreas Martin - Page 33 Hands-on 2 MANAGING PERSISTENT OBJECTS 3. Persistence Layer Based on: Goncalves, 2010: Beginning Java™ EE 6 Platform with GlassFish™ 3
  • 34. Andreas Martin - Page 34 Hands-on 2 1. Import the «hands-on-2» project. 2. Create the following entities: Address and Customer  Fields of Address: id, street1, city, zipcode und country.  Fields of Customer: id, firstName, lastName, email und address.  Please give the entities a unique table name. 3. Write a main method in a Main class and enter some data into the database. 3. Persistence Layer