EJB 3 Entity Relationships

Size: px
Start display at page:

Download "EJB 3 Entity Relationships"

Transcription

1 Berner Fachhochschule Technik und Informatik EJB 3 Entity Relationships Course Multi Tier Business Applications with Java EE Prof. Dr. Eric Dubuis Berner Fachhochschule Biel

2 Content What are relationships? Relationship types Relationship annotations Navigability of relationships An example Fetch strategies Cascading of Entity Manager operations May 6, 2008 MTA with Java EE / Entity Relationships 2

3 What Are Entity Relationships? Entity relationships are persistent associations between EJB entities. Example (short notation): ProductDescription (1)-----(*) Product Example, UML notation: ProductDescription -description : String -baseprice : float //... The O/R mapping might look like: 1 * +products getter and setter in class //... ProductDescription Product -partnumber : String PRODUCT_DESCRIPTION ID DESCRIPTION BASEPRICE PRODUCT ID PARTNUMBER PD_ID May 6, 2008 MTA with Java EE / Entity Relationships 3

4 Types of Entity Relationships one-to-one A a 1 can also denote: B Navigability unidirectional bidirectional A B A B 1 one-to-many A * B A B * many-to-one A 1 B A B A B * many-to-many A B A B A B * Relationships are polymorphic. 7 combinations! May 6, 2008 MTA with Java EE / Entity Relationships 4

5 Relationship Annotations One of the following relationship annotations must be added to the persistent property or field: You'll use the following types for collections: java.util.collection java.util.set java.util.list java.util.map An empty collection (and not null) should be returned if the many side is empty. interfaces can be initialized with concrete types, e.g. List<Product> p = new ArrayList<Product>(); May 6, 2008 MTA with Java EE / Entity Relationships 5

6 Relationship Annotations (cont'd) Note: If the persistent property or persistent field is a collection-type property or field then it is necessary to specify the entity that is the target of the relationship. There are two possibilities: Person * 1 +employees Company by parameterized private Set<Person> employees; by specifying the target entity with the = Person.class) private Set employees; May 6, 2008 MTA with Java EE / Entity Relationships 6

7 Relationship Annotations (cont'd) Note: The targetentity element in relationship annotations must also be used if entities implement Java interfaces denoting the business concepts. «interface» Customer 1 * «interface» Order For example: Customer Entity Order = OrderEntity.class) private List<Order> orders; May 6, 2008 MTA with Java EE / Entity Relationships 7

8 Direction (Navigability) of Relationships Relationships can be: bidirectional unidirectional You must know which side is the owning side... Characteristics of a bidirectional relationship: has an owning side has an inverse side A B Characteristics of a unidirectional relationship: has only an owning side The owning side determines the updates to the relationship in the database. Bidirectional relationships between managed entities will be persisted based on references held by the owning side of the relationship. [EJB Persistence, 3.2.3] May 6, 2008 MTA with Java EE / Entity Relationships 8

9 Rules For Bidirectional Relationships [EJB Persistence, 2.1.7] Reason for mappedby : if there are 2 or more relationships between the same entities Person * owns > * lives > House * 1 The inverse side must refer to its owning side by use of mappedby element @ManyToOne, annotation. The many side of one-to-many / many-to-one bidirectional relationships must be the owning side, hence the mappedby element cannot be specified on annotation. For one-to-one bidirectional relationships, the owning side corresponds to the side that contains the corresponding foreign key. For many-to-many bidirectional relationships either side may be the owning side. Additional mapping annotations (e.g., column, table) may be specified. The persistence provider handles the object-relational mapping of the relationships. May 6, 2008 MTA with Java EE / Entity Relationships 9

10 Field or Property Annotations for Relationships Relationships are another kind of fields or properties. Given the field or property strategy of an entity you must use one of the following kinds of annotations for a relationship: field type field: private Address address; Person public Address getaddress() { return address; public void setaddress(address a) { address = a; 1 1 Address property: private Address public Address getaddress() { return address; public void setaddress(address a) { address = a; May 6, 2008 MTA with Java EE / Entity Relationships 10

11 Example: Bidirectional One-to-Many Relationship Recall the preceding example (short notation): ProductDescription (1)-----(*) Product Recall: OneToMany, ManyToOne ==> owning side is always the many side UML notation: ProductDescription -description : String -baseprice : float // * inverse +products owning Product -partnumber : String //... May 6, 2008 MTA with Java EE / Entity Relationships 11

12 Fragment of Product Entity 1 0..* public class Product implements private int id; Product // Details, e.g., no-arg constructor, omitted, except: public Product(ProductDescription pd) { productdescription = pd; // This class is the owner of the relationship. // [EJB Persistence, private ProductDescription productdescription;... public ProductDescription getproductdescription() { return this.productdescription; Must match... (next slide) public void setproductdescription(productdescription pd) { this.productdescription = pd; May 6, 2008 MTA with Java EE / Entity Relationships 12

13 Fragment of ProductDescription Entity ProductDescription 1 public class ProductDescription implements private int id; Product // details, e.g., no-arg constructor, omitted... // This is the inverse side of the relationship. // [EJB Persistence, (mappedby = "productdescription") private Collection<Product> products;... with this (previous slide) public Collection<Product> getproducts() { return products; public void setproducts(collection<product> products) { this.products = products; May 6, 2008 MTA with Java EE / Entity Relationships 13

14 A Session Bean as Manager A factory method for creating a ProductDescription public class ProductManagerBean implements ProductManager private EntityManager em;... // Business method, called by a remote client: public ProductDescription createproductdescription(string text, BigDecimal price) { ProductDescription pd = new ProductDescription(text, price); this.em.persist(pd); return pd;... // continued on the next slide... May 6, 2008 MTA with Java EE / Entity Relationships 14

15 A Session Bean as Manager A factory method for creating Product entities: // in class ProductManagerBean public void createproducts(productdescription pd, int howmany) { Product p = null; for (int i = 0; i < howmany; i++) { // Complete: p = new Product(pd); this.em.persist(p); Constructor initializes relationship field // continued on next slide... May 6, 2008 MTA with Java EE / Entity Relationships 15

16 A Session Bean as Manager Given the id, the following methods return the corresponding entities: // in class ProductManagerBean By default, product entities public ProductDescription will not be getproductdescriptionbyid(object id) { fetched. return this.em. find(productdescription.class, id); public Product getproductbyid(object id) { return this.em. find(product.class, id);... By default, product description entities will be fetched, too. May 6, 2008 MTA with Java EE / Entity Relationships 16

17 A Remote Client An excerpt of a remote client might look like: // In some client-side class: private ProductManager manager =...; public ProductDescription createproductdescription(string text, BigDecimal price) { return manager.createproductdescription(text, price); public void createproduct(productdescription pd, int howmany) { manager.createproduct(pd, howmany); Notice the navigability of the relationship public void printproduct(object pid) { Product p = manager.getproductbyid(pid); System.out.println(p.getPartNumber() + "," + p.getproductdescription().getdescription() + "," + p.getproductdescription().getbaseprice()); May 6, 2008 MTA with Java EE / Entity Relationships 17

18 Navigability from the Inverse Side of a One-To-Many Relationship A client can first obtain a product description, and then the collection of associated products: // In some client-side class: public void printproducts(object pdid) { ProductDescription pd = manager.getproductdescriptionbyid(pdid); System.out.println(pd.getDescription()+ ":"); for (Product p: pd.getproducts()) { System.out.println(p.getPartNumber()); To get a ProductDescription entity having all its Product entities of the oneto-many relationship requires a FetchType.EAGER loading strategy at the inverse side of the relationship, see next slide. May 6, 2008 MTA with Java EE / Entity Relationships 18

19 Eager Fetching at the Inverse You'll have to modify the inverse side of the one-to-many relationship to eagerly fetch the public class ProductDescription implements private int id; // This is the inverse side of the relationship. // [EJB Persistence, ] // Eager productdescription, fetch = FetchType.EAGER) private Collection<Product> products;... The fetch strategy FetchType.EAGER implies that then loading the ProductDescription entity, all its related Product entities are loaded as well. ProductDescription 1 0..* Product May 6, 2008 MTA with Java EE / Entity Relationships 19

20 Fetch Strategy The FetchType enum defines strategies for fetching data from the database: public enum FetchType { LAZY, EAGER ; The EAGER strategy is a requirement on the persistence provider runtime that data must be eagerly fetched. The LAZY strategy is a hint to the persistence provider runtime that data should be fetched lazily when it is first accessed. Relationship Type EAGER LAZY EAGER LAZY May 6, 2008 MTA with Java EE / Entity Relationships 20

21 Cascading Persist, Merge, Remove, and Refresh Operations The cascade element specifies the set of cascadable operations that are propagated to the associated entity. The operations that are cascadable are defined by the CascadeType enum: public enum CascadeType { ALL, PERSIST, MERGE, REMOVE, REFRESH ; REMOVE can be applied in The value OneToOne cascade=all and OneToMany is equivalent to cascade={persist, MERGE, REMOVE, REFRESH. Cascade Strategy By default, no operation is cascaded May 6, 2008 MTA with Java EE / Entity Relationships 21

22 Cascading Persist, Merge, Remove, and Refresh Operations (cont'd) Given the Person and Address public class Person... // owning side private Address public class Address... {... You cascade an operation by specifying the cascade public class Person... = ALL) // owning side private Address address; In a session bean, a Person entity and its Address entity are updated: // in a session private EntityManager em; public void updateperson(person p) { this.em.merge(p); If p contains a modified address, it is updated, too! May 6, 2008 MTA with Java EE / Entity Relationships 22

23 Non-Optional Relationships If a relationship cannot be null then you public class Person... optional = false) // owning side private Address address; The element value optional = false denotes that a Person entity must always have an associated Address entity in the persistent store, that is, at the time of a COMMIT performed by the container. May 6, 2008 MTA with Java EE / Entity Relationships 23

24 Summary of Elements in Relationship Annotations Element Name targetentity cascade fetch optional mappedby Type Class CascadeType[] FetchType boolean String Remarks Non-generic collections; interfaces for business abstractions Default: none Inverse side only; not May 6, 2008 MTA with Java EE / Entity Relationships 24

25 Dereferencing Non-Fetched Collections at the Client If a client dereferences the collection of a detached entity whose items were not previously fetched when an exception is raised: detached ProductDescription 1 0..* getproductdescription Product LAZY assumed :ProductDescription :ProductDescription p1:product px:product Collection Proxy p2:product pn:product May 6, 2008 MTA with Java EE / Entity Relationships 25

26 References [EJB] JSR 220: Enterprise JavaBeans, Version 3.0 EJB 3.0 Simplified API [EJB Core] JSR 220: Enterprise JavaBeans, Version 3.0 EJB Core Contracts and Requirements [EJB Persistence] JSR 220: Enterprise JavaBeansTM,Version 3.0 Java Persistence API May 6, 2008 MTA with Java EE / Entity Relationships 26

EJB 3 Entity Relationships

EJB 3 Entity Relationships Berner Fachhochschule Technik und Informatik EJB 3 Entity Relationships Course Multi Tier Business Applications with Java EE Prof. Dr. Eric Dubuis Berner Fachhochschule Biel Content What are relationships?

More information

EJB 3 Entities. Course Multi Tier Business Applications with Java EE. Prof. Dr. Eric Dubuis Berner Fachhochschule Biel. Berner Fachhochschule

EJB 3 Entities. Course Multi Tier Business Applications with Java EE. Prof. Dr. Eric Dubuis Berner Fachhochschule Biel. Berner Fachhochschule Berner Fachhochschule Technik und Informatik EJB 3 Entities Course Multi Tier Business Applications with Java EE Prof. Dr. Eric Dubuis Berner Fachhochschule Biel Content Characteristics of entities Programming

More information

JPA Entities. Course Multi Tier Business Applications with Java EE. Prof. Dr. Eric Dubuis Berner Fachhochschule Biel. Berner Fachhochschule

JPA Entities. Course Multi Tier Business Applications with Java EE. Prof. Dr. Eric Dubuis Berner Fachhochschule Biel. Berner Fachhochschule Berner Fachhochschule Technik und Informatik JPA Entities Course Multi Tier Business Applications with Java EE Prof. Dr. Eric Dubuis Berner Fachhochschule Biel Content Characteristics of entities Programming

More information

Java EE Architecture, Part Three. Java EE architecture, part three 1(69)

Java EE Architecture, Part Three. Java EE architecture, part three 1(69) Java EE Architecture, Part Three Java EE architecture, part three 1(69) Content Requirements on the Integration layer The Database Access Object, DAO Pattern Frameworks for the Integration layer Java EE

More information

The Good, the Bad and the Ugly

The Good, the Bad and the Ugly The Good, the Bad and the Ugly 2 years with Java Persistence API Björn Beskow bjorn.beskow@callistaenterprise.se www.callistaenterprise.se Agenda The Good Wow! Transparency! The Bad Not that transparent

More information

Stateful Session Beans

Stateful Session Beans Berner Fachhochschule Technik und Informatik Stateful Session Beans Course Multi Tier Business Applications with Java EE Prof. Dr. Eric Dubuis Berner Fachhochschule Biel Content Characteristics of stateful

More information

Introduction to JPA. Fabio Falcinelli

Introduction to JPA. Fabio Falcinelli Introduction to JPA Fabio Falcinelli Me, myself and I Several years experience in active enterprise development I love to design and develop web and standalone applications using Python Java C JavaScript

More information

Java EE Architecture, Part Three. Java EE architecture, part three 1(57)

Java EE Architecture, Part Three. Java EE architecture, part three 1(57) Java EE Architecture, Part Three Java EE architecture, part three 1(57) Content Requirements on the Integration layer The Database Access Object, DAO Pattern Frameworks for the Integration layer Java EE

More information

What data persistence means? We manipulate data (represented as object state) that need to be stored

What data persistence means? We manipulate data (represented as object state) that need to be stored 1 Data Persistence What data persistence means? We manipulate data (represented as object state) that need to be stored persistently to survive a single run of the application queriably to be able to retrieve/access

More information

Java Persistence API (JPA)

Java Persistence API (JPA) Java Persistence API (JPA) Petr Křemen petr.kremen@fel.cvut.cz Winter Term 2016 Petr Křemen (petr.kremen@fel.cvut.cz) Java Persistence API (JPA) Winter Term 2016 1 / 53 Contents 1 Data Persistence 2 From

More information

JPA The New Enterprise Persistence Standard

JPA The New Enterprise Persistence Standard JPA The New Enterprise Persistence Standard Mike Keith michael.keith@oracle.com http://otn.oracle.com/ejb3 About Me Co-spec Lead of EJB 3.0 (JSR 220) Java EE 5 (JSR 244) expert group member Co-author Pro

More information

Lightweight J2EE Framework

Lightweight J2EE Framework Lightweight J2EE Framework Struts, spring, hibernate Software System Design Zhu Hongjun Session 4: Hibernate DAO Refresher in Enterprise Application Architectures Traditional Persistence and Hibernate

More information

A COMPONENT BASED ONLINE ORDERING SYSTEM USING ENTERPRISE JAVABEANS 3.0

A COMPONENT BASED ONLINE ORDERING SYSTEM USING ENTERPRISE JAVABEANS 3.0 A COMPONENT BASED ONLINE ORDERING SYSTEM USING ENTERPRISE JAVABEANS 3.0 AUTHOR: JAMES OSBORNE SUPERVISOR: DR. KUNG KIU LAU 2 MAY 2007 ABSTRACT Title: A Component Based Online Ordering System Using Enterprise

More information

EJB 3.0 Puzzlers. Mike Keith, Oracle Corp. Colorado Software Summit: October 21 26, 2007

EJB 3.0 Puzzlers. Mike Keith, Oracle Corp.   Colorado Software Summit: October 21 26, 2007 EJB 3.0 Puzzlers Mike Keith, Oracle Corp. michael.keith@oracle.com http://otn.oracle.com/ejb3 Slide 1 About Me Co-spec Lead of EJB 3.0 (JSR 220) and Java EE 5 (JSR 244) expert group member Currently working

More information

Database Connection using JPA. Working with the Java Persistence API (JPA) consists of using the following interfaces:

Database Connection using JPA. Working with the Java Persistence API (JPA) consists of using the following interfaces: JPA - drugi deo Database Connection using JPA Working with the Java Persistence API (JPA) consists of using the following interfaces: Database Connection using JPA Overview A connection to a database is

More information

Generation of EJB3 Artifacts in a Modeling Platform

Generation of EJB3 Artifacts in a Modeling Platform Generation of EJB3 Artifacts in a Modeling Platform Master Thesis Submitted by: Xinhua Gu Informatik-Ingenieurwesen Matriculation Number: 15248 Supervised by: Prof. Dr. Ralf Möller (STS) Prof. Dr. Rolf-Rainer

More information

Course "UML and Design Patterns" of module "Software Engineering and Design", version February 2011 (X)

Course UML and Design Patterns of module Software Engineering and Design, version February 2011 (X) UML Class Diagrams Prof. Dr. Eric Dubuis, @ Biel Course "UML and Design Patterns" of module "Software Engineering and Design", version February 2011 (X) BFH/TI/Software Engineering and Design/UML and Design

More information

Practice Test. Oracle 1z Java Enterprise Edition 5 Business Component Developer Certified Professional Upgrade Exam. Version: 14.

Practice Test. Oracle 1z Java Enterprise Edition 5 Business Component Developer Certified Professional Upgrade Exam. Version: 14. Oracle 1z0-861 Java Enterprise Edition 5 Business Component Developer Certified Professional Upgrade Exam Practice Test Version: 14.22 QUESTION NO: 1 A developer wants to create a business interface for

More information

On Polymorphism and the Open-Closed Principle

On Polymorphism and the Open-Closed Principle Berner Fachhochschule Engineering and Information Technology On Polymorphism and the Open-Closed Principle Prof. Dr. Eric Dubuis Berner Fachhochschule, Engineering and Information Technology @ Biel Course

More information

JPA. Java persistence API

JPA. Java persistence API JPA Java persistence API JPA Entity classes JPA Entity classes are user defined classes whose instances can be stored in a database. JPA Persistable Types The term persistable types refers to data types

More information

Final Release. Sun Microsystems. JSR 220: Enterprise JavaBeans TM,Version 3.0. Java Persistence API. EJB 3.0 Expert Group

Final Release. Sun Microsystems. JSR 220: Enterprise JavaBeans TM,Version 3.0. Java Persistence API. EJB 3.0 Expert Group microsystems Sun Microsystems JSR 220: Enterprise JavaBeans TM,Version 3.0 Java Persistence API EJB 3.0 Expert Group Specification Lead: Linda DeMichiel, Sun Microsystems Michael Keith, Oracle Corporation

More information

Information systems modelling UML and service description languages

Information systems modelling UML and service description languages Internet Engineering Tomasz Babczyński, Zofia Kruczkiewicz Tomasz Kubik Information systems modelling UML and service description languages Laboratory 4 Design patterns used to build the Integration nad

More information

Java EE Architecture, Part Three. Java EE architecture, part three 1(24)

Java EE Architecture, Part Three. Java EE architecture, part three 1(24) Java EE Architecture, Part Three Java EE architecture, part three 1(24) Content Requirements on the Integration layer The Database Access Object, DAO Pattern JPA Performance Issues Java EE architecture,

More information

object/relational persistence What is persistence? 5

object/relational persistence What is persistence? 5 contents foreword to the revised edition xix foreword to the first edition xxi preface to the revised edition xxiii preface to the first edition xxv acknowledgments xxviii about this book xxix about the

More information

Shale and the Java Persistence Architecture. Craig McClanahan Gary Van Matre. ApacheCon US 2006 Austin, TX

Shale and the Java Persistence Architecture. Craig McClanahan Gary Van Matre. ApacheCon US 2006 Austin, TX Shale and the Java Persistence Architecture Craig McClanahan Gary Van Matre ApacheCon US 2006 Austin, TX 1 Agenda The Apache Shale Framework Java Persistence Architecture Design Patterns for Combining

More information

Information systems modelling UML and service description languages

Information systems modelling UML and service description languages Internet Engineering Tomasz Babczyński, Zofia Kruczkiewicz Tomasz Kubik Information systems modelling UML and service description languages Laboratory 4 Design patterns used to build the Integration nad

More information

Pro JPA 2. Mastering the Java Persistence API. Apress* Mike Keith and Merrick Schnicariol

Pro JPA 2. Mastering the Java Persistence API. Apress* Mike Keith and Merrick Schnicariol Pro JPA 2 Mastering the Java Persistence API Mike Keith and Merrick Schnicariol Apress* Gootents at a Glance g V Contents... ; v Foreword _ ^ Afooyt the Author XXj About the Technical Reviewer.. *....

More information

Deployment. See Packaging and deployment processes

Deployment. See Packaging and deployment processes Index A Address instance, 85 Aggregate average response time (AART), 282 Application assembler, deployment roles external requirements conflict and redundant, 343 dependencies, 341 references, 341 342

More information

Enterprise JavaBeans 3.1

Enterprise JavaBeans 3.1 SIXTH EDITION Enterprise JavaBeans 3.1 Andrew Lee Rubinger and Bill Burke O'REILLY* Beijing Cambridge Farnham Kbln Sebastopol Tokyo Table of Contents Preface xv Part I. Why Enterprise JavaBeans? 1. Introduction

More information

Java Persistence API (JPA) Entities

Java Persistence API (JPA) Entities Java Persistence API (JPA) Entities JPA Entities JPA Entity is simple (POJO) Java class satisfying requirements of JavaBeans specification Setters and getters must conform to strict form Every entity must

More information

CO Java EE 6: Develop Database Applications with JPA

CO Java EE 6: Develop Database Applications with JPA CO-77746 Java EE 6: Develop Database Applications with JPA Summary Duration 4 Days Audience Database Developers, Java EE Developers Level Professional Technology Java EE 6 Delivery Method Instructor-led

More information

"Charting the Course... Mastering EJB 3.0 Applications. Course Summary

Charting the Course... Mastering EJB 3.0 Applications. Course Summary Course Summary Description Our training is technology centric. Although a specific application server product will be used throughout the course, the comprehensive labs and lessons geared towards teaching

More information

Fast Track to EJB 3.0 and the JPA Using JBoss

Fast Track to EJB 3.0 and the JPA Using JBoss Fast Track to EJB 3.0 and the JPA Using JBoss The Enterprise JavaBeans 3.0 specification is a deep overhaul of the EJB specification that is intended to improve the EJB architecture by reducing its complexity

More information

Dali Java Persistence Tools. User Guide Release 2.0 for Eclipse

Dali Java Persistence Tools. User Guide Release 2.0 for Eclipse Dali Java Persistence Tools User Guide Release 2.0 for Eclipse May 2008 Dali Java Persistence Tools User Guide Copyright 2006, 2008 Oracle. All rights reserved. The Eclipse Foundation makes available all

More information

Module 8 The Java Persistence API

Module 8 The Java Persistence API Module 8 The Java Persistence API Objectives Describe the role of the Java Persistence API (JPA) in a Java EE application Describe the basics of Object Relational Mapping Describe the elements and environment

More information

Enterprise JavaBeans, Version 3 (EJB3) Programming

Enterprise JavaBeans, Version 3 (EJB3) Programming Enterprise JavaBeans, Version 3 (EJB3) Programming Description Audience This course teaches developers how to write Java Enterprise Edition (JEE) applications that use Enterprise JavaBeans, version 3.

More information

Berner Fachhochschule. Technik und Informatik JAX-WS. Java API for XML-Based Web Services. Prof. Dr. Eric Dubuis Berner Fachhochschule Biel

Berner Fachhochschule. Technik und Informatik JAX-WS. Java API for XML-Based Web Services. Prof. Dr. Eric Dubuis Berner Fachhochschule Biel Berner Fachhochschule Technik und Informatik JAX-WS Java API for XML-Based Web Services Prof. Dr. Eric Dubuis Berner Fachhochschule Biel Overview The motivation for JAX-WS Architecture of JAX-WS and WSDL

More information

Web Application Development Using JEE, Enterprise JavaBeans and JPA

Web Application Development Using JEE, Enterprise JavaBeans and JPA Web Application Development Using JEE, Enterprise Java and JPA Duration: 5 days Price: $2795 *California residents and government employees call for pricing. Discounts: We offer multiple discount options.

More information

Web Application Development Using JEE, Enterprise JavaBeans and JPA

Web Application Development Using JEE, Enterprise JavaBeans and JPA Web Application Development Using JEE, Enterprise Java and JPA Duration: 35 hours Price: $750 Delivery Option: Attend training via an on-demand, self-paced platform paired with personal instructor facilitation.

More information

Topics in Enterprise Information Management

Topics in Enterprise Information Management Topics in Enterprise Information Management Dr. Ilan Kirsh JPA Basics Object Database and ORM Standards and Products ODMG 1.0, 2.0, 3.0 TopLink, CocoBase, Castor, Hibernate,... EJB 1.0, EJB 2.0: Entity

More information

High-Performance Hibernate VLAD MIHALCEA

High-Performance Hibernate VLAD MIHALCEA High-Performance Hibernate VLAD MIHALCEA About me @Hibernate Developer vladmihalcea.com @vlad_mihalcea vladmihalcea Agenda Performance and Scaling Connection providers Identifier generators Relationships

More information

foreword to the first edition preface xxi acknowledgments xxiii about this book xxv about the cover illustration

foreword to the first edition preface xxi acknowledgments xxiii about this book xxv about the cover illustration contents foreword to the first edition preface xxi acknowledgments xxiii about this book xxv about the cover illustration xix xxxii PART 1 GETTING STARTED WITH ORM...1 1 2 Understanding object/relational

More information

Chapter 7. The Annotations Alternative

Chapter 7. The Annotations Alternative Chapter 7. The Annotations Alternative Hibernate Annotations 1 / 33 Hibernate Annotations Java Annotation is a way to add information about a piece of code (typically a class, field, or method to help

More information

CSE 530A. Lab 3. Washington University Fall 2013

CSE 530A. Lab 3. Washington University Fall 2013 CSE 530A Lab 3 Washington University Fall 2013 Table Definitions The table definitions for lab 3 are slightly different from those for lab 2 Serial ID columns have been added to all of the tables Lab 2:

More information

Java Persistence API. Patrick Linskey EJB Team Lead BEA Systems Oracle

Java Persistence API. Patrick Linskey EJB Team Lead BEA Systems Oracle Java Persistence API Patrick Linskey EJB Team Lead BEA Systems Oracle plinskey@bea.com Patrick Linskey EJB Team Lead at BEA JPA 1, 2 EG Member Agenda JPA Basics What s New ORM Configuration APIs Queries

More information

Java EE / EJB Security

Java EE / EJB Security Berner Fachhochschule Technik und Informatik Java EE / EJB Security Course Multi Tier Business Applications with Java EE Prof. Dr. Eric Dubuis Berner Fachhochschule Biel Ambition Standard Security Modells

More information

Developing Java EE 5 Applications from Scratch

Developing Java EE 5 Applications from Scratch Developing Java EE 5 Applications from Scratch Copyright Copyright 2006 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without

More information

On Polymorphism and the Open-Closed Principle

On Polymorphism and the Open-Closed Principle On Polymorphism and the Open-Closed Principle Prof. Dr. Eric Dubuis Berner Fachhochschule, @ Biel Course "UML and Design Patterns" of module "Software Engineering and Design", version March 2008 BFH/TI/Software

More information

JPA. Java Persistence API

JPA. Java Persistence API JPA Java Persistence API Introduction The Java Persistence API provides an object/relational mapping facility for managing relational data in Java applications Created as part of EJB 3.0 within JSR 220

More information

Exploring EJB3 With JBoss Application Server Part 6.2

Exploring EJB3 With JBoss Application Server Part 6.2 By Swaminathan Bhaskar 01/24/2009 Exploring EJB3 With JBoss Application Server Part 6.2 In this part, we will continue to explore Entity Beans Using Java Persistence API (JPA). Thus far, we have seen examples

More information

Dali Java Persistence Tools. User Guide Release for Eclipse

Dali Java Persistence Tools. User Guide Release for Eclipse Dali Java Persistence Tools User Guide Release 1.0.0 for Eclipse May 2007 Dali Java Persistence Tools User Guide Copyright 2006, 2007 Oracle. All rights reserved. The Eclipse Foundation makes available

More information

Object-Relational Mapping is NOT serialization! You can perform queries on each field!

Object-Relational Mapping is NOT serialization! You can perform queries on each field! ORM Object-Relational Mapping is NOT serialization! You can perform queries on each field! Using hibernate stand-alone http://www.hibernatetutorial.com/ Introduction to Entities The Sun Java Data Objects

More information

U2 Clients and APIs. Java Persistence API User Guide. Version July 2014 UCC-100-JPA-UG-01

U2 Clients and APIs. Java Persistence API User Guide. Version July 2014 UCC-100-JPA-UG-01 U2 Clients and APIs Java Persistence API User Guide Version 1.0.0 July 2014 UCC-100-JPA-UG-01 Notices Edition Publication date: July 2014 Book number: UCC-100-JPA-UG-01 Product version: U2 Java Persistence

More information

Chapter 1 Introducing EJB 1. What is Java EE Introduction to EJB...5 Need of EJB...6 Types of Enterprise Beans...7

Chapter 1 Introducing EJB 1. What is Java EE Introduction to EJB...5 Need of EJB...6 Types of Enterprise Beans...7 CONTENTS Chapter 1 Introducing EJB 1 What is Java EE 5...2 Java EE 5 Components... 2 Java EE 5 Clients... 4 Java EE 5 Containers...4 Introduction to EJB...5 Need of EJB...6 Types of Enterprise Beans...7

More information

Developing Applications with Java EE 6 on WebLogic Server 12c

Developing Applications with Java EE 6 on WebLogic Server 12c Developing Applications with Java EE 6 on WebLogic Server 12c Duration: 5 Days What you will learn The Developing Applications with Java EE 6 on WebLogic Server 12c course teaches you the skills you need

More information

SUN Sun Cert Bus Component Developer Java EE Platform 5, Upgrade. Download Full Version :

SUN Sun Cert Bus Component Developer Java EE Platform 5, Upgrade. Download Full Version : SUN 310-092 Sun Cert Bus Component Developer Java EE Platform 5, Upgrade Download Full Version : https://killexams.com/pass4sure/exam-detail/310-092 D. A javax.ejb.nosuchentityexception is thrown. Answer:

More information

find() method, 178 forclass() method, 162 getcurrentsession(), 16 getexecutablecriteria() method, 162 get() method, 17, 177 getreference() method, 178

find() method, 178 forclass() method, 162 getcurrentsession(), 16 getexecutablecriteria() method, 162 get() method, 17, 177 getreference() method, 178 Index A accessor() method, 58 Address entity, 91, 100 @AllArgsConstructor annotations, 106 107 ArrayList collection, 110 Arrays, 116 Associated objects createalias() method, 165 166 createcriteria() method,

More information

Introduction to Java Enterprise Edition For Database Application Developer

Introduction to Java Enterprise Edition For Database Application Developer CMP 420/758 Introduction to Java Enterprise Edition For Database Application Developer Department of Mathematics and Computer Science Lehman College, the CUNY 1 Java Enterprise Edition Developers today

More information

Middleware for Heterogeneous and Distributed Information Systems Sample Solution Exercise Sheet 5

Middleware for Heterogeneous and Distributed Information Systems Sample Solution Exercise Sheet 5 AG Heterogene Informationssysteme Prof. Dr.-Ing. Stefan Deßloch Fachbereich Informatik Technische Universität Kaiserslautern Middleware for Heterogeneous and Distributed Information Systems Sample Solution

More information

Hibernate OGM Architecture

Hibernate OGM Architecture HIBERNATE OGM Hibernate OGM Architecture Hibernate OGM Architecture http://docs.jboss.org/hibernate/ogm/4.0/reference/en-us/html_single/ Data Persistence How is Data Persisted Abstraction between the application

More information

Information systems modelling UML and service description languages

Information systems modelling UML and service description languages Internet Engineering Tomasz Babczyński, Zofia Kruczkiewicz Tomasz Kubik Information systems modelling UML and service description languages Laboratory 3 Examplary multitiered Information System (Java EE

More information

= "categories") 1 public class Category implements java.io.serializable { 2 private static final long serialversionuid = 1L;

= categories) 1 public class Category implements java.io.serializable { 2 private static final long serialversionuid = 1L; @Entity @Table(name = "categories") 1 public class Category implements java.io.serializable { 2 private static final long serialversionuid = 1L; @Id @GeneratedValue 3 private Long id; 4 private String

More information

Java EE Application Assembly & Deployment Packaging Applications, Java EE modules. Model View Controller (MVC)2 Architecture & Packaging EJB Module

Java EE Application Assembly & Deployment Packaging Applications, Java EE modules. Model View Controller (MVC)2 Architecture & Packaging EJB Module Java Platform, Enterprise Edition 5 (Java EE 5) Core Java EE Java EE 5 Platform Overview Java EE Platform Distributed Multi tiered Applications Java EE Web & Business Components Java EE Containers services

More information

Working with the Java Pages Feature. PegaRULES ProcessCommander Versions 5.1 and 5.2

Working with the Java Pages Feature. PegaRULES ProcessCommander Versions 5.1 and 5.2 Working with the Java Pages Feature PegaRULES ProcessCommander Versions 5.1 and 5.2 Copyright 2006 Pegasystems Inc., Cambridge, MA All rights reserved. This document and the software describe products

More information

Seam 3. Pete Muir JBoss, a Division of Red Hat

Seam 3. Pete Muir JBoss, a Division of Red Hat Seam 3 Pete Muir JBoss, a Division of Red Hat Road Map Introduction Java EE 6 Java Contexts and Dependency Injection Seam 3 Mission Statement To provide a fully integrated development platform for building

More information

Produced by. Design Patterns. MSc Computer Science. Eamonn de Leastar

Produced by. Design Patterns. MSc Computer Science. Eamonn de Leastar Design Patterns MSc Computer Science Produced by Eamonn de Leastar (edeleastar@wit.ie)! Department of Computing, Maths & Physics Waterford Institute of Technology http://www.wit.ie http://elearning.wit.ie

More information

Oracle EXAM - 1Z Java EE 6 Enterprise JavaBeans Developer Certified Expert Exam. Buy Full Product.

Oracle EXAM - 1Z Java EE 6 Enterprise JavaBeans Developer Certified Expert Exam. Buy Full Product. Oracle EXAM - 1Z0-895 Java EE 6 Enterprise JavaBeans Developer Certified Expert Exam Buy Full Product http://www.examskey.com/1z0-895.html Examskey Oracle 1Z0-895 exam demo product is here for you to test

More information

Apache OpenJPA User's Guide

Apache OpenJPA User's Guide Apache OpenJPA User's Guide Apache OpenJPA User's Guide 1. Introduction 1 1. OpenJPA.. 3 1.1. About This Document. 3 2. Java Persistence API 4 1. Introduction. 9 1.1. Intended Audience 9 1.2. Lightweight

More information

Servlets JSP EJB. Part III. Java Platform, Enterprise Edition (Java EE)

Servlets JSP EJB. Part III. Java Platform, Enterprise Edition (Java EE) Part III Java Platform, Enterprise Edition (Java EE) 65 Java Platform, Enterprise Edition (Java EE) Java Servlets and JSP pages in web access layer Enterprise JavaBeans 3.0 for implementing business logic

More information

Core Capabilities Part 3

Core Capabilities Part 3 2008 coreservlets.com The Spring Framework: Core Capabilities Part 3 Originals of Slides and Source Code for Examples: http://courses.coreservlets.com/course-materials/spring.html Customized Java EE Training:

More information

1Z Oracle. Java Enterprise Edition 5 Business Component Developer Certified Professional Upgrade

1Z Oracle. Java Enterprise Edition 5 Business Component Developer Certified Professional Upgrade Oracle 1Z0-861 Java Enterprise Edition 5 Business Component Developer Certified Professional Upgrade Download Full Version : https://killexams.com/pass4sure/exam-detail/1z0-861 A. The Version attribute

More information

Course "UML and Design Patterns" of module "Software Engineering and Design", version November 2011

Course UML and Design Patterns of module Software Engineering and Design, version November 2011 The Observer Pattern Prof. Dr. Eric Dubuis Berner Fachhochschule, @ Biel Course "UML and Design Patterns" of module "Software Engineering and Design", version November 20 BFH/TI/Software Engineering and

More information

Object-relational mapping EJB and Hibernate

Object-relational mapping EJB and Hibernate T A R T U Ü L I K O O L MATEMAATIKA-INFORMAATIKATEADUSKOND Arvutiteaduse instituut Infotehnoloogia eriala Aleksandr Tkatšenko Object-relational mapping EJB and Hibernate Referaat aines Tarkvaratehnika

More information

Java EE 6: Develop Business Components with JMS & EJBs

Java EE 6: Develop Business Components with JMS & EJBs Oracle University Contact Us: + 38516306373 Java EE 6: Develop Business Components with JMS & EJBs Duration: 4 Days What you will learn This Java EE 6: Develop Business Components with JMS & EJBs training

More information

Course UML and Design Patterns of module Software Engineering and Design, version November 18, 2013.

Course UML and Design Patterns of module Software Engineering and Design, version November 18, 2013. The Observer Pattern Prof. Dr. Eric Dubuis Berner Fachhochschule, Engineering and Information Technology @ Biel Course UML and Design Patterns of module Software Engineering and Design, version November

More information

Developing EJB Applications with Eclipse

Developing EJB Applications with Eclipse Developing EJB Applications with Eclipse Martin Heinemann martin.heinemann@tudor.lu Linuxdays.lu 2007 Februray 2007 Abstract This paper is the accompanying documentation for the Enterprise Java Beans/Eclipse

More information

Session 13. Reading. A/SettingUpJPA.htm JPA Best Practices

Session 13. Reading.  A/SettingUpJPA.htm JPA Best Practices Session 13 DB Persistence (JPA) Reading Reading Java EE 7 Tutorial chapters 37-39 NetBeans/Derby Tutorial www.oracle.com/webfolder/technetwork/tutorials/obe/java/settingupjp A/SettingUpJPA.htm JPA Best

More information

Refactoring to Seam. NetBeans. Brian Leonard Sun Microsystems, Inc. 14o

Refactoring to Seam. NetBeans. Brian Leonard Sun Microsystems, Inc. 14o Refactoring to Seam NetBeans Brian Leonard Sun Microsystems, Inc. 14o AGENDA 2 > The Java EE 5 Programming Model > Introduction to Seam > Refactor to use the Seam Framework > Seam Portability > Q&A Java

More information

Java- EE Web Application Development with Enterprise JavaBeans and Web Services

Java- EE Web Application Development with Enterprise JavaBeans and Web Services Java- EE Web Application Development with Enterprise JavaBeans and Web Services Duration:60 HOURS Price: INR 8000 SAVE NOW! INR 7000 until December 1, 2011 Students Will Learn How to write Session, Message-Driven

More information

Exploring EJB3 With JBoss Application Server Part 6.3

Exploring EJB3 With JBoss Application Server Part 6.3 By Swaminathan Bhaskar 02/07/2009 Exploring EJB3 With JBoss Application Server Part 6.3 In this part, we will continue to explore Entity Beans Using Java Persistence API (JPA). In the previous part, we

More information

CMP 436/774. Introduction to Java Enterprise Edition. Java Enterprise Edition

CMP 436/774. Introduction to Java Enterprise Edition. Java Enterprise Edition CMP 436/774 Introduction to Java Enterprise Edition Fall 2013 Department of Mathematics and Computer Science Lehman College, CUNY 1 Java Enterprise Edition Developers today increasingly recognize the need

More information

ADVANCED JAVA TRAINING IN BANGALORE

ADVANCED JAVA TRAINING IN BANGALORE ADVANCED JAVA TRAINING IN BANGALORE TIB ACADEMY #5/3 BEML LAYOUT, VARATHUR MAIN ROAD KUNDALAHALLI GATE, BANGALORE 560066 PH: +91-9513332301/2302 www.traininginbangalore.com 2EE Training Syllabus Java EE

More information

Entities are classes that need to be persisted, usually in a relational database. In this chapter we cover the following topics:

Entities are classes that need to be persisted, usually in a relational database. In this chapter we cover the following topics: Entities are classes that need to be persisted, usually in a relational database. In this chapter we cover the following topics: EJB 3 entities Java persistence API Mapping an entity to a database table

More information

Application Servers G Session 11 - Sub-Topic 2 Using Enterprise JavaBeans. Dr. Jean-Claude Franchitti

Application Servers G Session 11 - Sub-Topic 2 Using Enterprise JavaBeans. Dr. Jean-Claude Franchitti Application Servers G22.3033-011 Session 11 - Sub-Topic 2 Using Enterprise JavaBeans Dr. Jean-Claude Franchitti New York University Computer Science Department Courant Institute of Mathematical Sciences

More information

Exam Questions 1Z0-850

Exam Questions 1Z0-850 Exam Questions 1Z0-850 Java Standard Edition 5 and 6, Certified Associate Exam https://www.2passeasy.com/dumps/1z0-850/ 1. Which two are true? (Choose two.) A. J2EE runs on consumer and embedded devices.

More information

1Z Java SE 5 and 6, Certified Associate Exam Summary Syllabus Questions

1Z Java SE 5 and 6, Certified Associate Exam Summary Syllabus Questions 1Z0-850 Java SE 5 and 6, Certified Associate Exam Summary Syllabus Questions Table of Contents Introduction to 1Z0-850 Exam on Java SE 5 and 6, Certified Associate... 2 Oracle 1Z0-850 Certification Details:...

More information

WHAT IS EJB. Security. life cycle management.

WHAT IS EJB. Security. life cycle management. EJB WHAT IS EJB EJB is an acronym for enterprise java bean. It is a specification provided by Sun Microsystems to develop secured, robust and scalable distributed applications. To run EJB application,

More information

Advanced Persistency. Inheritance

Advanced Persistency. Inheritance Advanced Persistency Inheritance Mapping inheritance Id numpass numwhee ls SINGLE TABLE PER CLASS make 1 6 2 HORSE CART model NULL Id numpass numwhee ls make model accelerat ortype 2 1 2 HONDA HRC7 THROTTLE

More information

Short introduction to REST

Short introduction to REST Short introduction to REST HTTP Hypertext Transfer Protocol HTTP protocol methods: GET, POST, PUT, DELETE, OPTIONS, HEAD HTTP protocol is stateless Server does not know whether this is your first request,

More information

JVA-163. Enterprise JavaBeans

JVA-163. Enterprise JavaBeans JVA-163. Enterprise JavaBeans Version 3.0.2 This course gives the experienced Java developer a thorough grounding in Enterprise JavaBeans -- the Java EE standard for scalable, secure, and transactional

More information

UML Sequence Diagrams

UML Sequence Diagrams UML Sequence Diagrams Prof. Dr. Eric Dubuis Berner Fachhochschule, @ Biel Course "UML and Design Patterns" of module "Software Engineering and Design", version October 2008 BFH/TI/Software Engineering

More information

ObjectStore and Objectivity/DB. Application Development Model of Persistence Advanced Features

ObjectStore and Objectivity/DB. Application Development Model of Persistence Advanced Features Object-Oriented Oi t ddatabases ObjectStore and Objectivity/DB Application Development Model of Persistence Advanced Features Persistence Strategies Persistence by inheritance persistence capabilities

More information

Metadata driven component development. using Beanlet

Metadata driven component development. using Beanlet Metadata driven component development using Beanlet What is metadata driven component development? It s all about POJOs and IoC Use Plain Old Java Objects to focus on business logic, and business logic

More information

Introducing Design Patterns

Introducing Design Patterns Introducing Design Patterns Prof. Dr. Eric Dubuis Berner Fachhochschule, @ Biel Course "UML and Design Patterns" of module "Software Engineering and Design", version April 2009 (X) BFH/TI/Software Engineering

More information

Building Java Persistence API Applications with Dali 1.0 Shaun Smith

Building Java Persistence API Applications with Dali 1.0 Shaun Smith Building Java Persistence API Applications with Dali 1.0 Shaun Smith shaun.smith@oracle.com A little about Me Eclipse Dali JPA Tools Project Co-Lead Eclipse Persistence Services Project (EclipseLink) Ecosystem

More information

JPA Enhancement Guide (v5.1)

JPA Enhancement Guide (v5.1) JPA Enhancement Guide (v5.1) Table of Contents Maven..................................................................................... 3 Ant........................................................................................

More information

Business Component Development with EJB Technology, Java EE 5

Business Component Development with EJB Technology, Java EE 5 Business Component Development with EJB Technology, Java EE 5 Student Guide SL-351-EE5 REV D.2 D61838GC10 Edition 1.0 D62447 Copyright 2008, 2009, Oracle and/or its affiliates. All rights reserved. Disclaimer

More information

Teneo: Integrating EMF & EclipseLink

Teneo: Integrating EMF & EclipseLink Teneo: Integrating EMF & EclipseLink Model-Driven Development with Persistence Shaun Smith Martin Taal Stephan Eberle 2009 Eclipse Foundation; made available under the EPL v1.0 2 Teneo: Integrating EMF

More information

PART I IDENTIFICATION SHEET

PART I IDENTIFICATION SHEET PART I IDENTIFICATION SHEET Project ref. no. 045153 Project acronym ELLECTRA-WeB Project full title European Electronic Public Procurement Application Framework in the Western Balkan Region Security (distribution

More information

Implementing a Web Service p. 110 Implementing a Web Service Client p. 114 Summary p. 117 Introduction to Entity Beans p. 119 Persistence Concepts p.

Implementing a Web Service p. 110 Implementing a Web Service Client p. 114 Summary p. 117 Introduction to Entity Beans p. 119 Persistence Concepts p. Acknowledgments p. xvi Introduction p. xvii Overview p. 1 Overview p. 3 The Motivation for Enterprise JavaBeans p. 4 Component Architectures p. 7 Divide and Conquer to the Extreme with Reusable Services

More information