Knowledge Byte In this section, you will learn about:

Slides:



Advertisements
Similar presentations
J0 1 Marco Ronchetti - Basi di Dati Web e Distribuite – Laurea Specialistica in Informatica – Università di Trento.
Advertisements

11 Copyright © 2005, Oracle. All rights reserved. Creating the Business Tier: Enterprise JavaBeans.
EJB Entity Beans. Entity Beans Data versus logic Used to represent an instance rather than a collection of data (depending on underlying storage) Represents.
6/1/20151 Luca Simone Software Engineering 2 a.a. 2001/2002.
1 Softsmith Open Learning - EJB 21-Nov Enterprise Java Beans Introduction –Application ServerApplication Server –Java 2 Enterprise EditionJava.
Enterprise JavaBeans 2.0 Wu Lu (Cont’d). EJB2.0 Query Language EJB QL is a declarative language similar in many respects to SQL Is intended to be portable.
J2EE Security and Enterprise Java Beans Mrunal G. Dhond Department of Computing and Information Sciences Master of Science, Final Defense February 26,
Emmanuel Cecchet et al.  Performance Scalability of J2EE application servers.  Test effect of: ◦ Application Implementation Methods ◦ Container Design.
Chapter 10 EJB Concepts of EJB Three Components in Creating an EJB Starting/Stopping J2EE Server and Deployment Tool Installation and Configuration of.
EJB. Component Characteristics An enterprise Bean typically contains business logic that operates on the enterprise’s data. An enterprise Bean’s instances.
1 J2EE Components. 2 Application Servers relieve the programming burden for business distributed components. They provide support for system level services.
1 Session Bean Chuyên đề Lập trình Java & J2EE Chương 14 Biên soạn: Th.S Nguyễn văn Lành.
Enterprise Java Beans - (EJB)
Developing and Deploying Business Components using PowerJ.
Entity Beans BMP Celsina Bignoli
Middleware Technology (J2EE/EJB) Entity Bean. 2 Introduction to Entity Beans Persistence Concepts Entity beans are persistent objects that can be stored.
Lecture 8 Advanced Topics in Enterprise JavaBeans.
Enterprise Java Beans Part I Kyungmin Cho 2001/04/10.
Container-Managed Persistence (CMP) Entity Beans Lesson 3A / Slide 1 of 42J2EE Server Components Objectives In this lesson, you will learn to: Identify.
Distributed Systems 1 Master of Information System Management Distributed Systems Persistence.
Enterprise Java Bean Matt. 2 J2EE 3 J2EE Overview.
The Triad of Beans I Oleh: Dini Addiati ( ) Fahrurrozi Rahman ( Y) Irfan Hilmy ( ) Salman Azis A ( ) Aziiz Surahman.
Enterprise JavaBeans. Lesson 1: Introduction to Server-Side Component Software.
Enterprise JavaBeans. What is EJB? l An EJB is a specialized, non-visual JavaBean that runs on a server. l EJB technology supports application development.
EJB Framework.  As we know, EJB is the center of the J2EE architecture that provides a sturdy framework for building enterprise applications. The major.
Message-Driven Beans and EJB Security Lesson 4B / Slide 1 of 37 J2EE Server Components Objectives In this lesson, you will learn about: Identify features.
Enterprise JavaBeans Understanding EJB Components Version 0.1 Kamal Wickramanayake
Enterprise Java v041102EJB QL1 EJB Query Language Source: “Enterprise JavaBeans, 3rd Edition”, Richard Monson-Haefel.
Collaborate Lesson 4C / Slide 1 of 22 Collaborate Knowledge Byte In this section, you will learn about: The EJB timer service Message linking in EJB 2.1.
Creating competitive advantage Copyright © 2003 Enterprise Java Beans Presenter: Wickramanayake HMKSK Version:0.1 Last Updated:
Summing Up Object Oriented Design. Four Major Components: Abstraction modeling real-life entities by essential information only Encapsulation clustering.
Topic : Hibernate 1 Kaster Nurmukan. An ORM tool The problem fixed by ORM Advantage Hibernate Hibernate Basic –Hibernate sessionFactory –Hibernate Session.
EJB Overview: Constraint Types and Enforcement in JBoss Elissa Newman Fluid Meeting 6/3/04.
Entity Beans & Persistence Chris Alexander CS 486 Spring 2001.
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB Markus.
Introduction to EJB. What is an EJB ?  An enterprise java bean is a server-side component that encapsulates the business logic of an application. By.
Introduction to EJB. What is an EJB ?  An enterprise java bean is a server-side component that encapsulates the business logic of an application. By.
Java Programming: Advanced Topics 1 Enterprise JavaBeans Chapter 14.
Enterprise Java Beans N.V.RAJASEKHAR REDDY. Definition of EJB EJBs are the components that are the set of classes and interfaces deployed within a container.
Copyright © 2002 ProsoftTraining. All rights reserved. Enterprise JavaBeans.
13 Copyright © 2004, Oracle. All rights reserved. Managing Persistent Data in the Business Tier Entity EJBs.
Topic : Hibernate 1 Kaster Nurmukan. An ORM tool Used in data layer of applications Implements JPA.
©NIIT Introducing Enterprise JavaBeans (EJB) Lesson 1A / Slide 1 of 43J2EE Server Components Objectives In this lesson, you will learn about: The features.
Enterprise JavaBeans. Lesson 1: Introduction to Server-Side Component Software.
EJB. Introduction Enterprise Java Beans is a specification for creating server- side scalable, transactional, multi-user secure enterprise-level applications.
14 Copyright © 2004, Oracle. All rights reserved. Achieving State Management in the Business Tier.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
©NIIT Session Beans Lesson 1B/ Slide 1 of 37J2EE Server Components Objectives In this lesson, you will learn to: Describe the characteristics of session.
Entity Bean Chuyên đề Lập trình Java & J2EE Chương 15
CS 440 Database Management Systems
What’s New in SQL Server 2016 Master Data Services
IS444: Modern tools for applications development
IS444: Modern tools for applications development
Knowledge Byte In this section, you will learn about:
Database Performance Tuning and Query Optimization
Knowledge Byte In this section, you will learn about:
J2EE Application Development
Luca Simone Software Engineering 2 a.a. 2001/2002
Objectives In this lesson, you will learn to:
Understanding and Designing with EJB
Entity Beans B.Ramamurthy 2/17/2019 BR.
Component-based Applications
Knowledge Byte In this section, you will learn about:
Understanding and Designing with EJB
Chapter 11 Database Performance Tuning and Query Optimization
Developing and testing enterprise Java applications
Knowledge Byte In this section, you will learn about:
Enterprise Java Beans.
Knowledge Byte In this section, you will learn about:
Objectives In this lesson, you will learn about:
Presentation transcript:

Knowledge Byte In this section, you will learn about: Cascading deletes in entity beans Undefined primary key in entity bean Collaborate

Cascading Deletes in Entity Beans When you invoke the remove() method of a CMP entity bean’s EJB object, the container calls the corresponding ejbRemove() method of the bean implementation class. The ejbRemove() method is responsible for deleting data associated with the bean instance. EJB container first removes a CMP entity bean from various relationships and then deletes the bean and its associated data. You can delete an entity bean and the beans related to it, simultaneously. This involves initializing a series of deletions, starting with the specified CMP entity bean. The deletion continues till all the related entity beans have also been successfully removed. This technique is called cascading delete. Cascading delete is performed for one-to-one and one-to-many relationships between the entity beans. You can use the cascading delete technique when the other end of relationship has multiplicity 1. Collaborate

Cascading Deletes in Entity Beans (Contd.) The cascading delete cannot be implemented for *-* relationships. This is because in case of many-to-many relationships the beans are not related exclusively to each other. You perform the cascading delete operations by declaring the <cascade-delete/> tag in the <ejb-relationship-role> tag of the deployment descriptor of a CMP entity bean. Collaborate

Undefined Primary Key in Entity Beans You can define the primary key of a CMP entity bean at the time of its deployment. This technique is used when you do not know which field needs to be declared as a primary key at the time of coding an enterprise bean. Using this technique, you can specify primary key of the enterprise bean at deployment time. As a result, you can declare the primary key according to the type of database on which the bean is being deployed. The argument type of the findByPrimaryKey() method is declared as java.lang.Object when you declare primary key of an entity bean at deployment time. You need to declare the type of primary key class as java.lang.Object in the deployment descriptor. You also need to avoid accessing the primary key in the CMP entity bean methods because the primary key is only defined at deployment time. Collaborate

From the Expert’s Desk In this section, you will learn: Best Practice on: Tuning Entity Beans Tips and Tricks on: Lazy Loading of Entity Bean References When to Use Entity Beans FAQs on CMP and EJB-QL Collaborate

Best Practices Tuning Entity Beans You can optimize the performance of entity beans by using the following techniques: Using setEntityContext() as cache Committing data after completing a transaction Specifying entity beans instance cache size Using connection pool Collaborate

Tips and Tricks Lazy Loading of Entity Bean References Lazy loading: Refers to the process of delaying the loading of an entity bean’s related beans until the entity bean references them. Provides minimal overhead because it loads a related entity bean only when it is required Is performed by the bean provider in BMP by providing code for it. Is managed by EJB container in CMP beans. However, in CMP you need to enable this feature in the container in order to use it. Collaborate

Tips and Tricks When to Use Entity Beans The following techniques are used to store the data of an EJB application, and make it persistent: Using session beans with JDBC Using entity beans Collaborate

Parameter for Comparison Session beans with JDBC Tips and Tricks When to Use Entity Beans (Contd.) The following table compares the two types of persistence implementations in EJB applications: Parameter for Comparison Session beans with JDBC Entity Beans Control In session beans, bean provider has control over the connectivity because the code for connectivity is written and managed by the bean provider himself. In entity beans, EJB container manages the connectivity. The bean provider does not have much control over the connectivity and database access. Collaborate

Parameter for Comparison Session beans with JDBC Tips and Tricks When to Use Entity Beans (Contd.) Comparison between the two types of persistence implementations: (Contd.) Parameter for Comparison Session beans with JDBC Comparison Procedural versus object-oriented Session beans perform business operations and return the data as result sets that use the procedural approach. Entity beans use the object-oriented approach and are used to represent the Java objects that can support encapsulation and relationships. Caching Session beans represent only the business operations and they cannot be used for caching the data. The entity beans represent the data in the database. Therefore, the caching of data can be performed for the entity beans. Collaborate

Parameter for Comparison Session beans with JDBC Tips and Tricks When to Use Entity Beans (Contd.) Comparison between the two types of persistence implementations: (Contd.) Parameter for Comparison Session beans with JDBC Comparison Migration Session beans use directly or slightly modified SQL code for JDBC connectivity and database operations. Entity beans use the object-oriented approach and they require modifications in SQL code to implement the connectivity. Development time In case of session beans, you need to write the JDBC code for database connectivity and operations. In CMP entity beans, the code for database operations and connectivity is easily created and the development time is faster than the session beans with JDBC. Collaborate

FAQs What are the advantages of CMP entity beans as compared to BMP entity beans? CMP entity beans have the following advantages as compared to BMP entity beans: CMP beans are easier to write because you do not write the JDBC code. As a result, you can concentrate on implementing the business logic of application. CMP beans are more portable than BMP entity beans as BMP entity beans contain database-specific connectivity code. CMP beans provide an easier and simpler way to define the various relationships with other entity beans. You can specify and select the relationships in the GUI of the deployment tool. In a BMP entity bean, you have to write the code to implement and manage the relationships. Collaborate

FAQs (Contd.) What are the finder methods in EJB? The finder methods, declared in the home interface of an enterprise bean, are used by the clients to locate the entity beans. The finder methods are declared as starting with findBy prefix. The argument of a finder method is the field value based on which the entity bean object will be retrieved. The example of the finder methods are findByPrimaryKey() and findByName(). You need to import which interface while creating a CMP bean? You need to import the javax.ejb.EntityBean interface. Collaborate

FAQs (Contd.) What are the three main clauses of an EJB-QL query where path expressions can appear? The three clauses are, SELECT, FROM, and WHERE. What are the three types of literals used in EJB-QL? The three types of literals used in EJB QL are, string, numeric, and boolean. Collaborate

Challenge In CMP entity beans, the ____________ manages the persistence of the enterprise bean. The _____________ method is used to release the resources held by entity bean instance before the bean instance is sent to the Passivate stage. The __________ tag in the deployment descriptor specifies the type of persistence in entity beans. The __________ path expression is used to find whether an expression’s value falls within the specified range or not. The instantiated and unused instances of an enterprise bean are stored in _____________. Collaborate

Challenge (Contd.) The method(s) that make(s) an entity bean instance eligible for garbage collection is(are): ejbRemove() unsetEntityContext() finalize() a.      Only A is true b.      Both, B and C, are true c.      Only C is true d. Both, A and C, are true Collaborate

Challenge (Contd.) Who is responsible for providing the tools for reading and importing the information contained in the deployment descriptor and implementing the tasks of a container: Bean Provider Application Assembler Container Provider End User Collaborate

Solutions to Challenge EJB container ejbPassivate() <persistence-type> BETWEEN Shared pool c. Only C is true c. Container Provider Collaborate