This document discusses Java performance and contains sections on Java Persistence and EJB performance. It provides details on the Java Persistence API and its reference implementation, monitoring and tuning the EJB container including the thread pool and transaction isolation levels. It also outlines best practices for Enterprise Java Beans and Java Persistence including using appropriate fetch types, bulk updates and inheritance strategies.
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3 Skills Matter
This document discusses Java EE 6 and GlassFish 3. It outlines that Java EE 6 and GlassFish 3 aim to provide a light-weight, extensible, and powerful platform. Key goals for Java EE 6 include making it more flexible, extensible by embracing open source frameworks, and easier to use and develop on. GlassFish 3 is the open source reference implementation of Java EE 6 and includes new features like clustering and centralized administration.
Tools Coverage for the Java EE Platform @ Silicon Valley Code Camp 2010Arun Gupta
This document discusses tools support for the Java EE 6 platform in NetBeans, Eclipse, and IntelliJ IDEs. It provides an overview of Java EE 6 and demos of key Java EE 6 APIs like JPA, JSF 2.0, CDI, and JAX-RS being used in the different IDEs.
The document discusses the APIs and requirements for EJB 3.0 containers. EJB 3.0 containers must provide the full Java 2 platform API and make additional APIs available to enterprise beans, including the Java Persistence API, JTA 1.1, JMS 1.1, and JavaMail 1.4. The document also lists restrictions on what enterprise beans are allowed and not allowed to do, such as not attempting to manage threads or directly access files.
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011Arun Gupta
This document discusses OSGi-enabled Java applications in GlassFish. It provides an overview of OSGi and how it is used in GlassFish to provide modularity. Key points include:
- OSGi allows applications to be broken into modules or bundles that can be installed, uninstalled, started and stopped dynamically without restarting the container.
- In GlassFish, all modules are OSGi bundles which run on top of the OSGi framework. This provides stronger modularity compared to a non-OSGi application server.
- Benefits of using OSGi in GlassFish include demanding stronger modularity, enabling custom tailored application servers, and lazy loading of bundles based on usage patterns.
Understanding the nuts & bolts of Java EE 6Arun Gupta
The document discusses new features in Java EE 6 including managed beans 1.0 and interceptors 1.1. Managed beans 1.0 allow using POJOs as managed components with basic services like resource injection and lifecycle callbacks. Interceptors 1.1 allow intercepting method invocations and lifecycle events on target classes through annotations or deployment descriptors.
The document summarizes 50 new features of Java EE 7 presented by Arun Gupta in 50 minutes. It provides short descriptions and code examples for features in specifications like CDI, Bean Validation, Interceptors, Concurrency Utilities, JPA, JTA, EJB, JMS and others. The features include things like default enabling of CDI, method validation in Bean Validation, interceptors for constructors, managed executors for concurrency, schema generation in JPA, transaction scoping in CDI and JTA, disabling passivation of stateful sessions in EJB, and a simplified JMSContext API.
Java EE 6 workshop at Dallas Tech Fest 2011Arun Gupta
The document outlines the key features and capabilities of Java EE 6, which aims to provide more power to developers with less code. It discusses various Java EE 6 technologies like EJB 3.1, CDI, JPA 2.0, JSF 2.0, JAX-RS and how they simplify development. It also previews GlassFish 3.1, the reference implementation of Java EE 6 and talks about the next steps in the evolution of Java EE.
Running your Java EE applications in the CloudArun Gupta
This document discusses running Java EE 6 applications in the cloud using various platforms. It provides an overview of Java EE 6 and how it is well-suited for cloud deployments. It then discusses specific implementations on Amazon EC2, RightScale, Elastra, Joyent, and GlassFish distributions and roadmaps.
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3 Skills Matter
This document discusses Java EE 6 and GlassFish 3. It outlines that Java EE 6 and GlassFish 3 aim to provide a light-weight, extensible, and powerful platform. Key goals for Java EE 6 include making it more flexible, extensible by embracing open source frameworks, and easier to use and develop on. GlassFish 3 is the open source reference implementation of Java EE 6 and includes new features like clustering and centralized administration.
Tools Coverage for the Java EE Platform @ Silicon Valley Code Camp 2010Arun Gupta
This document discusses tools support for the Java EE 6 platform in NetBeans, Eclipse, and IntelliJ IDEs. It provides an overview of Java EE 6 and demos of key Java EE 6 APIs like JPA, JSF 2.0, CDI, and JAX-RS being used in the different IDEs.
The document discusses the APIs and requirements for EJB 3.0 containers. EJB 3.0 containers must provide the full Java 2 platform API and make additional APIs available to enterprise beans, including the Java Persistence API, JTA 1.1, JMS 1.1, and JavaMail 1.4. The document also lists restrictions on what enterprise beans are allowed and not allowed to do, such as not attempting to manage threads or directly access files.
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011Arun Gupta
This document discusses OSGi-enabled Java applications in GlassFish. It provides an overview of OSGi and how it is used in GlassFish to provide modularity. Key points include:
- OSGi allows applications to be broken into modules or bundles that can be installed, uninstalled, started and stopped dynamically without restarting the container.
- In GlassFish, all modules are OSGi bundles which run on top of the OSGi framework. This provides stronger modularity compared to a non-OSGi application server.
- Benefits of using OSGi in GlassFish include demanding stronger modularity, enabling custom tailored application servers, and lazy loading of bundles based on usage patterns.
Understanding the nuts & bolts of Java EE 6Arun Gupta
The document discusses new features in Java EE 6 including managed beans 1.0 and interceptors 1.1. Managed beans 1.0 allow using POJOs as managed components with basic services like resource injection and lifecycle callbacks. Interceptors 1.1 allow intercepting method invocations and lifecycle events on target classes through annotations or deployment descriptors.
The document summarizes 50 new features of Java EE 7 presented by Arun Gupta in 50 minutes. It provides short descriptions and code examples for features in specifications like CDI, Bean Validation, Interceptors, Concurrency Utilities, JPA, JTA, EJB, JMS and others. The features include things like default enabling of CDI, method validation in Bean Validation, interceptors for constructors, managed executors for concurrency, schema generation in JPA, transaction scoping in CDI and JTA, disabling passivation of stateful sessions in EJB, and a simplified JMSContext API.
Java EE 6 workshop at Dallas Tech Fest 2011Arun Gupta
The document outlines the key features and capabilities of Java EE 6, which aims to provide more power to developers with less code. It discusses various Java EE 6 technologies like EJB 3.1, CDI, JPA 2.0, JSF 2.0, JAX-RS and how they simplify development. It also previews GlassFish 3.1, the reference implementation of Java EE 6 and talks about the next steps in the evolution of Java EE.
Running your Java EE applications in the CloudArun Gupta
This document discusses running Java EE 6 applications in the cloud using various platforms. It provides an overview of Java EE 6 and how it is well-suited for cloud deployments. It then discusses specific implementations on Amazon EC2, RightScale, Elastra, Joyent, and GlassFish distributions and roadmaps.
The document discusses the evolution of the Java EE platform and new features in Java EE 6. It outlines how Java EE has moved from being robust but complex to becoming more lightweight and flexible with profiles and pruning of unused specifications. It describes key programming model improvements in Java EE 6 like managed beans, Contexts and Dependency Injection (CDI), and annotations that simplify development.
The document summarizes new features and changes coming in Java 7. Key points include:
- Major focus on ease of development through simplifying programming models and reducing code through annotations.
- "Rightsizing" the Java EE platform by pruning unused components like EJB entity beans and making parts of the platform optional.
- Significant changes like modularization through JSR 294, new invokedynamic bytecode for dynamic languages, and major JVM improvements like the G1 garbage collector.
- Many smaller language and API improvements like null dereference expressions, type inference, multi-catch, annotations on types, and a new NIO library.
This document provides an overview of new features and changes in Java 7, including improved support for dynamic languages through the invokedynamic instruction, string switching, try-with-resources, and minor language and API improvements. It also outlines two potential plans for future Java releases, with Plan A representing Java 7 as currently planned and Plan B splitting features between Java 7 and 8 to accelerate delivery.
The document discusses the evolution of the Java EE platform. Some key points include:
- Java EE 6 introduced many new APIs and improvements to existing APIs like EJB 3.1, JPA 2.0, Servlets 3.0, Bean Validation, Context and Dependency Injection.
- It aimed to make Java EE more lightweight, flexible and developer-friendly through features like the Web Profile, more annotations, and less XML configuration.
- New APIs and capabilities in Java EE 6 included managed beans, interceptors, RESTful web services, and better integration between technologies like JSF and EJB.
The document discusses Java EE 6 and its goals of being flexible, lightweight, and easier to develop on compared to previous versions. It outlines many of the new and updated specifications in Java EE 6, including Contexts and Dependency Injection, Bean Validation, JAX-RS, and others. It also describes key Java EE 6 concepts like managed beans, interceptors, and profiles aimed at improving ease of development.
The State of Java under Oracle at JCertif 2011Arun Gupta
The document discusses Oracle's strategy regarding Java, open source, and middleware. Key points include:
- Delivering a complete, open, integrated stack of hardware, infrastructure, database, middleware, and applications.
- Integrating Oracle software components to provide unique value to customers.
- Priorities for Java platforms include growing the developer base, adoption, competitiveness, and adapting to change.
- Details of new features in Java SE 7 like string switching and automatic resource management.
- Plans for Java SE 8 including language enhancements from Project Lambda and modularity.
The document discusses new features in Java Persistence API (JPA) 2.0, including more flexible object/relational mapping, an expanded query language, the addition of the Criteria API and Metamodel API, support for pessimistic locking and validation, and standardized configuration options. JPA 2.0 provides object/relational mapping for Java applications and allows developers to manage data persistence through an entity manager and query language.
Full Java EE 6 support, great developer experience, multiple yet simple admin tools, embedded mode, mutli-language runtime, OSGi modularity, ... The GlassFish set of feature reads like the roadmap of our closest competitors. See how they can work for you. Today.
The document discusses the GlassFish REST administration backend. It provides an agenda that covers background on JAX-RS and GlassFish, implementation details of the REST backend, tips and tricks, clients, and future plans. It discusses how GlassFish uses configuration beans and the command line interface to manage configuration through REST.
This document summarizes a presentation about using Google App Engine (GAE) and Contexts and Dependency Injection (CDI) on Java EE applications. It discusses initial problems with using GAE and CDI due to limitations of the platforms and differences between development and production environments. It also covers solutions to these problems including abstracting the GAE API, using CDI extensively, and thorough testing. The goal is to build applications that can be ported between GAE and JBoss Application Server.
This document provides an overview of Java EE 6 and how it can simplify enterprise application development. It discusses the evolution of Java EE and new features in Java EE 6 like profiles, pruning of legacy technologies, pluggability, dependency injection, RESTful web services, and validation APIs. It also covers tools like NetBeans IDE and Glassfish application server and demonstrates a bookstore application.
This document discusses the history and evolution of OpenEJB and EJB specifications. It provides a timeline of OpenEJB from 1999 to present and notes David Blevins' involvement in the EJB 2.1, 3.0, 3.1, and 3.2 specifications. It also summarizes the components, lifecycle, views, services, environment, and packaging aspects of EJB from versions 1.1 through 3.1. Finally, it outlines some ideas for the next generation of EJB, including changes to components, services, interceptors, exceptions, and other areas.
The document discusses new features in Oracle8i for administrators, including Java in the database, optimizer and query improvements, summary management, indexes and partitioning, universal installer migration and upgrade features, manageability features, availability and recoverability, Net8 features, SQL*Plus and national language support, database security, and partial additions. Key points covered include Java virtual machine integration, SQLJ and JDBC, using Java with Oracle, Java configuration, Internet file system, and stored outlines for optimizer plan stability.
Java EE 6 Hands-on Workshop at Dallas Tech Fest 2010Arun Gupta
The document provides an overview of the Java EE 6 Hands-on Workshop being conducted by Arun Gupta. It includes an agenda for the workshop covering topics like Java EE 6 specifications, managed beans, interceptors, servlets, and ease of development features in Java EE 6. The workshop aims to demonstrate how Java EE 6 provides a flexible, extensible and easier to use platform for application development.
This document discusses Java Database Connectivity (JDBC) and Oracle JDBC drivers. It provides an overview of JDBC, describing the four types of JDBC architectures and key JDBC components. It then focuses on Oracle JDBC drivers, explaining the different driver types used on the client-side and server-side. Finally, it presents results from performance tests comparing the Oracle Thin driver, OCI driver, and internal driver across connection, query, fetch, and update operations.
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010Arun Gupta
The document discusses integrating OSGi and Java EE technologies in GlassFish. It provides an overview of OSGi and how GlassFish leverages OSGi for modularity. Key points include:
- GlassFish runs on top of OSGi and all GlassFish modules are OSGi bundles. This provides improved modularity over traditional Java EE servers.
- OSGi enables features like dynamic installation/uninstallation of bundles without restarting the server. It also allows multiple versions of modules to coexist.
- The document discusses how various Java EE technologies like EJB, JPA, JAX-WS can be integrated with OSGi. This allows OSGi bundles to leverage Java EE services.
- GlassFish
This document discusses strategies for improving web application performance in Java. It covers monitoring and tuning web containers, including optimizing thread pool parameters, connection queues, and request handling. The document also provides best practices for Java servlets, JSPs, caching content, managing sessions, leveraging HTTP server file caches, and analyzing access logs to enhance performance.
Embracing Jakarta EE 10 not only enable you to write better structured applications, it also enables you to write more testable applications. Correctly leveraging CDI enables integration testing where you can simulate a database error and verify that JMS messages are lost due to a RuntimeException. This session will focus on strategies and techniques for testing message handing, transaction management, security, and data model integrity. You will see how you can check message delivery and error handling, session failover, database versioning, and two-phase commits with JMS and databases. All too often assumptions are made that are proven wrong in production. This session will show you how to take your testing to the next level.
Java beans are reusable software components that follow conventions like having a no-arg constructor and getter and setter methods. JSP allows for rapidly developing dynamic web pages and features like platform independence, an extensible tag library, and reusability. To deploy a Java bean in a JSP page, the bean is first constructed, then it can be accessed and used within JSP tags and scriptlets during page processing by the JSP engine.
Enterprise Java Beans (EJB) is a development architecture for building highly scalable and robust enterprise level applications to be deployed on J2EE compliant Application Server such as JBOSS, Web Logic etc. EJB 3.0 is being a great shift from EJB 2.0 and makes development of EJB based applications quite easy.
The document discusses the evolution of the Java EE platform and new features in Java EE 6. It outlines how Java EE has moved from being robust but complex to becoming more lightweight and flexible with profiles and pruning of unused specifications. It describes key programming model improvements in Java EE 6 like managed beans, Contexts and Dependency Injection (CDI), and annotations that simplify development.
The document summarizes new features and changes coming in Java 7. Key points include:
- Major focus on ease of development through simplifying programming models and reducing code through annotations.
- "Rightsizing" the Java EE platform by pruning unused components like EJB entity beans and making parts of the platform optional.
- Significant changes like modularization through JSR 294, new invokedynamic bytecode for dynamic languages, and major JVM improvements like the G1 garbage collector.
- Many smaller language and API improvements like null dereference expressions, type inference, multi-catch, annotations on types, and a new NIO library.
This document provides an overview of new features and changes in Java 7, including improved support for dynamic languages through the invokedynamic instruction, string switching, try-with-resources, and minor language and API improvements. It also outlines two potential plans for future Java releases, with Plan A representing Java 7 as currently planned and Plan B splitting features between Java 7 and 8 to accelerate delivery.
The document discusses the evolution of the Java EE platform. Some key points include:
- Java EE 6 introduced many new APIs and improvements to existing APIs like EJB 3.1, JPA 2.0, Servlets 3.0, Bean Validation, Context and Dependency Injection.
- It aimed to make Java EE more lightweight, flexible and developer-friendly through features like the Web Profile, more annotations, and less XML configuration.
- New APIs and capabilities in Java EE 6 included managed beans, interceptors, RESTful web services, and better integration between technologies like JSF and EJB.
The document discusses Java EE 6 and its goals of being flexible, lightweight, and easier to develop on compared to previous versions. It outlines many of the new and updated specifications in Java EE 6, including Contexts and Dependency Injection, Bean Validation, JAX-RS, and others. It also describes key Java EE 6 concepts like managed beans, interceptors, and profiles aimed at improving ease of development.
The State of Java under Oracle at JCertif 2011Arun Gupta
The document discusses Oracle's strategy regarding Java, open source, and middleware. Key points include:
- Delivering a complete, open, integrated stack of hardware, infrastructure, database, middleware, and applications.
- Integrating Oracle software components to provide unique value to customers.
- Priorities for Java platforms include growing the developer base, adoption, competitiveness, and adapting to change.
- Details of new features in Java SE 7 like string switching and automatic resource management.
- Plans for Java SE 8 including language enhancements from Project Lambda and modularity.
The document discusses new features in Java Persistence API (JPA) 2.0, including more flexible object/relational mapping, an expanded query language, the addition of the Criteria API and Metamodel API, support for pessimistic locking and validation, and standardized configuration options. JPA 2.0 provides object/relational mapping for Java applications and allows developers to manage data persistence through an entity manager and query language.
Full Java EE 6 support, great developer experience, multiple yet simple admin tools, embedded mode, mutli-language runtime, OSGi modularity, ... The GlassFish set of feature reads like the roadmap of our closest competitors. See how they can work for you. Today.
The document discusses the GlassFish REST administration backend. It provides an agenda that covers background on JAX-RS and GlassFish, implementation details of the REST backend, tips and tricks, clients, and future plans. It discusses how GlassFish uses configuration beans and the command line interface to manage configuration through REST.
This document summarizes a presentation about using Google App Engine (GAE) and Contexts and Dependency Injection (CDI) on Java EE applications. It discusses initial problems with using GAE and CDI due to limitations of the platforms and differences between development and production environments. It also covers solutions to these problems including abstracting the GAE API, using CDI extensively, and thorough testing. The goal is to build applications that can be ported between GAE and JBoss Application Server.
This document provides an overview of Java EE 6 and how it can simplify enterprise application development. It discusses the evolution of Java EE and new features in Java EE 6 like profiles, pruning of legacy technologies, pluggability, dependency injection, RESTful web services, and validation APIs. It also covers tools like NetBeans IDE and Glassfish application server and demonstrates a bookstore application.
This document discusses the history and evolution of OpenEJB and EJB specifications. It provides a timeline of OpenEJB from 1999 to present and notes David Blevins' involvement in the EJB 2.1, 3.0, 3.1, and 3.2 specifications. It also summarizes the components, lifecycle, views, services, environment, and packaging aspects of EJB from versions 1.1 through 3.1. Finally, it outlines some ideas for the next generation of EJB, including changes to components, services, interceptors, exceptions, and other areas.
The document discusses new features in Oracle8i for administrators, including Java in the database, optimizer and query improvements, summary management, indexes and partitioning, universal installer migration and upgrade features, manageability features, availability and recoverability, Net8 features, SQL*Plus and national language support, database security, and partial additions. Key points covered include Java virtual machine integration, SQLJ and JDBC, using Java with Oracle, Java configuration, Internet file system, and stored outlines for optimizer plan stability.
Java EE 6 Hands-on Workshop at Dallas Tech Fest 2010Arun Gupta
The document provides an overview of the Java EE 6 Hands-on Workshop being conducted by Arun Gupta. It includes an agenda for the workshop covering topics like Java EE 6 specifications, managed beans, interceptors, servlets, and ease of development features in Java EE 6. The workshop aims to demonstrate how Java EE 6 provides a flexible, extensible and easier to use platform for application development.
This document discusses Java Database Connectivity (JDBC) and Oracle JDBC drivers. It provides an overview of JDBC, describing the four types of JDBC architectures and key JDBC components. It then focuses on Oracle JDBC drivers, explaining the different driver types used on the client-side and server-side. Finally, it presents results from performance tests comparing the Oracle Thin driver, OCI driver, and internal driver across connection, query, fetch, and update operations.
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010Arun Gupta
The document discusses integrating OSGi and Java EE technologies in GlassFish. It provides an overview of OSGi and how GlassFish leverages OSGi for modularity. Key points include:
- GlassFish runs on top of OSGi and all GlassFish modules are OSGi bundles. This provides improved modularity over traditional Java EE servers.
- OSGi enables features like dynamic installation/uninstallation of bundles without restarting the server. It also allows multiple versions of modules to coexist.
- The document discusses how various Java EE technologies like EJB, JPA, JAX-WS can be integrated with OSGi. This allows OSGi bundles to leverage Java EE services.
- GlassFish
This document discusses strategies for improving web application performance in Java. It covers monitoring and tuning web containers, including optimizing thread pool parameters, connection queues, and request handling. The document also provides best practices for Java servlets, JSPs, caching content, managing sessions, leveraging HTTP server file caches, and analyzing access logs to enhance performance.
Embracing Jakarta EE 10 not only enable you to write better structured applications, it also enables you to write more testable applications. Correctly leveraging CDI enables integration testing where you can simulate a database error and verify that JMS messages are lost due to a RuntimeException. This session will focus on strategies and techniques for testing message handing, transaction management, security, and data model integrity. You will see how you can check message delivery and error handling, session failover, database versioning, and two-phase commits with JMS and databases. All too often assumptions are made that are proven wrong in production. This session will show you how to take your testing to the next level.
Java beans are reusable software components that follow conventions like having a no-arg constructor and getter and setter methods. JSP allows for rapidly developing dynamic web pages and features like platform independence, an extensible tag library, and reusability. To deploy a Java bean in a JSP page, the bean is first constructed, then it can be accessed and used within JSP tags and scriptlets during page processing by the JSP engine.
Enterprise Java Beans (EJB) is a development architecture for building highly scalable and robust enterprise level applications to be deployed on J2EE compliant Application Server such as JBOSS, Web Logic etc. EJB 3.0 is being a great shift from EJB 2.0 and makes development of EJB based applications quite easy.
1) Enterprise JavaBeans (EJBs) are server-side components that expose methods for performing application logic. There are two main types: session beans and message-driven beans.
2) Session beans represent actions or a session and can be either stateless or stateful. Stateless session beans handle a single request and do not maintain conversational state, while stateful session beans span multiple requests and retain state for an individual client.
3) The document provides an example of a bank account application using EJBs, and describes the components of an EJB including business interfaces, EJB classes, and packaging into an EJB JAR file.
Enterprise JavaBeans (EJB) are server-side components that allow developers to write business logic independently of underlying middleware services like transactions and security. EJBs run within an EJB container managed by an application server, which handles these services automatically. The EJB specification defines standards for container functionality, component model, and interfaces to support portability of EJBs across application servers.
This document provides information about Revanth Online Training and their Core Java, Advanced Java, and J2EE online training courses. The Core Java course is 30 hours and covers topics like OOPs, strings, packages, exceptions, multithreading, I/O streams, generics and collections. The Advanced Java course also lasts 30 hours and covers JDBC, servlets, JSP, servers and databases. The 45-hour J2EE course covers topics like RMI, EJB, JNDI, JMS, and more. It provides the course content and duration for each topic.
Евгений Капинос "Advanced JPA (Java Persistent API)"Anna Shymchenko
The document discusses Java Persistence API (JPA), which is a specification that defines a Java API for object-relational mapping. It describes how JPA was created through the Java Community Process and references implementation. It also provides an overview of key JPA concepts including entities, the entity manager factory, entity managers, persistence contexts, and transaction types.
Java EE 6 provides enhancements to ease of development and extensibility. Key changes include introducing profiles like the Web Profile to make the platform more flexible. The platform is being right sized by pruning unused technologies. Extensibility is improved by embracing open source frameworks. Development is eased through increased use of annotations and reducing the need for deployment descriptors. The first preview release of the Java EE 6 reference implementation GlassFish is available now ahead of the final release later in 2009.
This document provides an overview of the Java Persistence API (JPA). It defines JPA as a framework that allows developers to manage relational data in Java applications. JPA consists of an API, the Java Persistence Query Language, and object-relational metadata. It defines an Entity Manager runtime API to process queries and transactions on objects in the database. JPA aims to provide a simpler object-relational mapping approach compared to earlier specifications like EJB2. Some key benefits of JPA include requiring fewer classes, using annotations instead of descriptors, and adding support for polymorphism and inheritance.
This document provides an overview of the Java Persistence API (JPA). It defines JPA as a framework that allows developers to manage relational data in Java applications. JPA consists of an API, the Java Persistence Query Language, and object-relational metadata. It defines an Entity Manager runtime API to process queries and transactions on objects in the database. JPA aims to provide a simpler object-relational mapping approach compared to earlier specifications like EJB2. Some key benefits of JPA include requiring fewer classes, using annotations instead of descriptors, and adding support for concepts like polymorphism and inheritance.
The document provides an overview of the Java Persistence API (JPA). It defines JPA as a framework that helps developers control relational data in Java applications. JPA offers developers an easier way to access and manipulate relational data compared to previous solutions. It consists of the JPA API, the Java Persistence Query Language (JPQL), and object-relational metadata. JPA defines a runtime API to process queries and transactions on objects against a database, and JPQL allows querying objects from the database in a SQL-like syntax. The document also compares JPA to EJB solutions, noting advantages like reduced complexity and the ability to use outside an application server.
Enterprise JavaBeans (EJBs) are reusable software components that can represent either data (entity beans) or business logic (session beans). EJBs provide benefits like transaction management, security, and the ability to be deployed on application servers. There are different types of session beans, including stateful and stateless, and entity beans can use either bean-managed or container-managed persistence to access a database. To use an EJB, a client first locates its home interface using JNDI and then calls methods on the home interface to access the bean.
Contextual Dependency Injection for Apachecon 2010Rohit Kelapure
The document discusses the history and evolution of Java EE and its specifications such as EJB and JSF. It introduces key concepts in Java EE 6 including Contexts and Dependency Injection (CDI), which provides a standard way to inject dependencies into Java objects without hardcoding them. CDI allows for loose coupling through contextual lifecycles and scopes, interceptors, and producers that control bean instantiation.
Java EE 6 & GlassFish v3: Paving the path for the future - Tech Days 2010 IndiaArun Gupta
This document discusses Java EE 6 and GlassFish v3. It outlines the goals of making Java EE more lightweight, extensible, and easier to develop on. Key features of Java EE 6 include a web profile, pruning of specifications, embrace of open source frameworks, and continued focus on ease of development. GlassFish v3 is the reference implementation and is modular, embeddable, extensible, and supports dynamic languages and frameworks.
Stateful session beans maintain conversational state between client requests by saving the bean's state to a database or file when it is passivated. This state is then restored when the bean is activated for a new client request. The container uses object serialization to save and restore the bean's state. Stateful session beans are appropriate when a business process requires multiple method invocations, while stateless session beans are better for single method calls since they do not maintain conversational state between invocations.
The document provides an agenda for a Java EE 6 Hands-on Workshop being conducted by Arun Gupta. It outlines the history and evolution of Java EE from version 1.2 to 6, highlights new specifications in Java EE 6 including Contexts and Dependency Injection and Bean Validation, and discusses goals and features of Java EE 6 like making it more lightweight and easier to develop on.
The document discusses Java EE 6 and its evolution over time. It outlines key features of Java EE 6 including lightweight profiles, annotations, managed beans, interceptors, and Servlets 3.0. It provides examples of using managed beans, interceptors, and the new annotations-based approach in Servlets 3.0. The document aims to educate developers on the nuts and bolts of Java EE 6.
This document discusses benchmarking multitiered Java applications. It covers challenges in benchmarking these applications, considerations for enterprise benchmarking including defining the system under test and performance metrics. It also discusses application server monitoring and profiling enterprise applications.
This document discusses strategies for optimizing web services performance. It covers topics like XML performance, using the appropriate XML parsing API, validating XML efficiently, optimizing external entity resolution, partial XML processing, web service benchmarking, factors affecting performance like message size and schema complexity, and best practices such as using MTOM, custom providers, and Fast Infoset.
This document discusses benchmarking Java applications. It covers challenges like warmup time, garbage collection, and Java time APIs. It also discusses designing experiments through clearly stating questions and hypotheses testing. Statistical methods for benchmarking are presented, including averaging, standard deviation, confidence intervals, and hypothesis testing.
The document describes the step-by-step methodology for tuning the Java Virtual Machine (JVM). It discusses determining system requirements and performance goals, choosing a JVM deployment model and runtime configuration, tuning garbage collection fundamentals, analyzing memory footprint and tuning for latency/responsiveness. Specific techniques covered include sizing the young and old generations, tuning survivor space size, CMS initiation occupancy and pause time.
This document discusses strategies for improving Java application performance, including reducing system CPU usage, addressing lock contention, optimizing volatile usage, resizing data structures efficiently, increasing parallelism, and other tips. Specific strategies covered in more depth include using Java NIO for non-blocking operations to reduce system CPU, identifying and fixing lock contention issues, replacing unnecessary volatile usage, ensuring data structures resize appropriately, keeping threads busy by addressing idle threads, and various other performance tuning techniques.
This document discusses tools and techniques for profiling Java applications, including the Solaris Studio Performance Analyzer and NetBeans IDE Profiler. It provides details on collecting profiling data, viewing results through the analyzer GUI or command line, and analyzing metrics like method execution times, memory usage, and thread activity to identify performance bottlenecks.
This document discusses monitoring Java Virtual Machine (JVM) performance. It covers monitoring garbage collection, the JIT compiler, class loading, and Java applications. It provides details on metrics, commands, and tools to monitor these aspects of the JVM and Java applications, including JConsole, VisualVM, and JMX. Monitoring is important for tuning performance and troubleshooting issues.
This document provides an overview of the Java Virtual Machine (JVM). It discusses the key components of the HotSpot JVM including the architecture, runtime environment, class loading process, bytecode interpretation, exception handling, synchronization, thread management, and Java Native Interface. The runtime environment is responsible for command line parsing, the JVM lifecycle such as loading, linking and initialization of classes, bytecode interpretation, and thread management. The document also describes class loading in the JVM, bytecode verification, and class data sharing. It provides details on synchronization approaches like object monitor mapping and biased locks. Finally, it discusses thread management aspects including JVM internal threads, safe points, and thread lifecycles.
This document discusses strategies for monitoring operating system performance on Java applications. It covers monitoring CPU utilization, memory usage, disk I/O, network I/O, and more using tools like Windows Performance Monitor, vmstat, mpstat, and sar. The document provides guidance on measuring performance on Windows, Linux, Solaris and SPARC systems. It is part of a larger document on Java performance that also discusses profiling Java applications, tuning the JVM, and benchmarking.
This document outlines an introduction to Java performance, including 12 chapters on strategies, approaches and methodologies for Java performance. It discusses forces at play in performance, top-down versus bottom-up approaches, choosing the right platform and CPU architecture, and evaluating system performance. It also provides an overview of operating system and JVM monitoring, Java application profiling tips, tuning the JVM, benchmarking Java applications, and analyzing web and web service performance.
This document compares containers and virtual machines for application deployment architecture. It outlines the architectural differences between containers running applications directly on the host operating system compared to virtual machines running isolated operating systems. A hybrid approach is discussed that uses both containers and virtual machines. Finally, it summarizes that virtual machines are better suited for legacy applications while containers are better for new web applications, and that a combined approach can utilize the advantages of both technologies.
This presentation was provided by Racquel Jemison, Ph.D., Christina MacLaughlin, Ph.D., and Paulomi Majumder. Ph.D., all of the American Chemical Society, for the second session of NISO's 2024 Training Series "DEIA in the Scholarly Landscape." Session Two: 'Expanding Pathways to Publishing Careers,' was held June 13, 2024.
The chapter Lifelines of National Economy in Class 10 Geography focuses on the various modes of transportation and communication that play a vital role in the economic development of a country. These lifelines are crucial for the movement of goods, services, and people, thereby connecting different regions and promoting economic activities.
Leveraging Generative AI to Drive Nonprofit InnovationTechSoup
In this webinar, participants learned how to utilize Generative AI to streamline operations and elevate member engagement. Amazon Web Service experts provided a customer specific use cases and dived into low/no-code tools that are quick and easy to deploy through Amazon Web Service (AWS.)
Temple of Asclepius in Thrace. Excavation resultsKrassimira Luka
The temple and the sanctuary around were dedicated to Asklepios Zmidrenus. This name has been known since 1875 when an inscription dedicated to him was discovered in Rome. The inscription is dated in 227 AD and was left by soldiers originating from the city of Philippopolis (modern Plovdiv).
This document provides an overview of wound healing, its functions, stages, mechanisms, factors affecting it, and complications.
A wound is a break in the integrity of the skin or tissues, which may be associated with disruption of the structure and function.
Healing is the body’s response to injury in an attempt to restore normal structure and functions.
Healing can occur in two ways: Regeneration and Repair
There are 4 phases of wound healing: hemostasis, inflammation, proliferation, and remodeling. This document also describes the mechanism of wound healing. Factors that affect healing include infection, uncontrolled diabetes, poor nutrition, age, anemia, the presence of foreign bodies, etc.
Complications of wound healing like infection, hyperpigmentation of scar, contractures, and keloid formation.
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumMJDuyan
(𝐓𝐋𝐄 𝟏𝟎𝟎) (𝐋𝐞𝐬𝐬𝐨𝐧 𝟏)-𝐏𝐫𝐞𝐥𝐢𝐦𝐬
𝐃𝐢𝐬𝐜𝐮𝐬𝐬 𝐭𝐡𝐞 𝐄𝐏𝐏 𝐂𝐮𝐫𝐫𝐢𝐜𝐮𝐥𝐮𝐦 𝐢𝐧 𝐭𝐡𝐞 𝐏𝐡𝐢𝐥𝐢𝐩𝐩𝐢𝐧𝐞𝐬:
- Understand the goals and objectives of the Edukasyong Pantahanan at Pangkabuhayan (EPP) curriculum, recognizing its importance in fostering practical life skills and values among students. Students will also be able to identify the key components and subjects covered, such as agriculture, home economics, industrial arts, and information and communication technology.
𝐄𝐱𝐩𝐥𝐚𝐢𝐧 𝐭𝐡𝐞 𝐍𝐚𝐭𝐮𝐫𝐞 𝐚𝐧𝐝 𝐒𝐜𝐨𝐩𝐞 𝐨𝐟 𝐚𝐧 𝐄𝐧𝐭𝐫𝐞𝐩𝐫𝐞𝐧𝐞𝐮𝐫:
-Define entrepreneurship, distinguishing it from general business activities by emphasizing its focus on innovation, risk-taking, and value creation. Students will describe the characteristics and traits of successful entrepreneurs, including their roles and responsibilities, and discuss the broader economic and social impacts of entrepreneurial activities on both local and global scales.
A Visual Guide to 1 Samuel | A Tale of Two HeartsSteve Thomason
These slides walk through the story of 1 Samuel. Samuel is the last judge of Israel. The people reject God and want a king. Saul is anointed as the first king, but he is not a good king. David, the shepherd boy is anointed and Saul is envious of him. David shows honor while Saul continues to self destruct.
Gender and Mental Health - Counselling and Family Therapy Applications and In...PsychoTech Services
A proprietary approach developed by bringing together the best of learning theories from Psychology, design principles from the world of visualization, and pedagogical methods from over a decade of training experience, that enables you to: Learn better, faster!
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.pptHenry Hollis
The History of NZ 1870-1900.
Making of a Nation.
From the NZ Wars to Liberals,
Richard Seddon, George Grey,
Social Laboratory, New Zealand,
Confiscations, Kotahitanga, Kingitanga, Parliament, Suffrage, Repudiation, Economic Change, Agriculture, Gold Mining, Timber, Flax, Sheep, Dairying,
How to Setup Warehouse & Location in Odoo 17 InventoryCeline George
In this slide, we'll explore how to set up warehouses and locations in Odoo 17 Inventory. This will help us manage our stock effectively, track inventory levels, and streamline warehouse operations.
3. Java Persistence and EJB Performance
3
1. EJB Programming Model
2. The Java Persistence API and Its Reference Implementation
3. Monitoring and Tuning the EJB Container
4. Transaction Isolation Level
5. Best Practices in Enterprise Java Beans
6. Best Practices in Java Persistence
6. Java Persistence and EJB Performance
6
1. EJB Programming Model
2. The Java Persistence API and Its Reference Implementation
3. Monitoring and Tuning the EJB Container
4. Transaction Isolation Level
5. Best Practices in Enterprise Java Beans
6. Best Practices in Java Persistence
7. Java Persistence and EJB Performance
7
JPA Reference Implementation
JPA layer between business logic and
database
13. Java Persistence and EJB Performance
13
JPA Reference Implementation
1 Full Identity Map Objects are never evicted from the cache unless deleted
2 Weak Identity Map Objects are held in Weak References, which allows the
JVM to garbage collect them when there are no other
references from the application Weak Identity Map
3 Soft Identity Map Objects are held in Soft References, which allows the
JVM to garbage collect them when memory is low
4 Soft Cache Weak Identity Map This option maintains a most frequently used subcache
of soft references in addition to the Identity Map cache
5 Hard Cache Weak Identity Map This option maintains a most frequently used subcache
of hard references in addition to the Identity Map cache
14. Java Persistence and EJB Performance
14
1. EJB Programming Model
2. The Java Persistence API and Its Reference Implementation
3. Monitoring and Tuning the EJB Container
4. Transaction Isolation Level
5. Best Practices in Enterprise Java Beans
6. Best Practices in Java Persistence
15. Java Persistence and EJB Performance
15
Monitoring and Tuning the EJB Container
Thread Pool
16. Java Persistence and EJB Performance
16
Monitoring and Tuning the EJB Container
Thread Pool
17. Java Persistence and EJB Performance
17
Monitoring and Tuning the EJB Container
Thread Pool
18. Java Persistence and EJB Performance
18
Monitoring and Tuning the EJB Container
Thread Pool
19. Java Persistence and EJB Performance
19
Monitoring and Tuning the EJB Container
Thread Pool
20. Java Persistence and EJB Performance
20
Monitoring and Tuning the EJB Container
Thread Pool
SNo. PropertyName Description
1 steady-pool-size minimum number of instances maintained in
the pool
2 max-pool-size maximum number of beans in the
pool
3 pool-idle-timeout-in-seconds maximum time that a stateless session bean or
message driven bean is allowed to be idle in
the pool
21. Java Persistence and EJB Performance
21
Monitoring and Tuning the EJB Container
Thread Pool
22. Java Persistence and EJB Performance
22
Monitoring and Tuning the EJB Container
Thread Pool
23. Java Persistence and EJB Performance
23
Monitoring and Tuning the EJB Container
Thread Pool
Stateful Bean Cache Entity Bean Cache
Ready Cache Transactional Cache
Invisible to user
(txnid,entityid)(entityid)
24. Java Persistence and EJB Performance
24
Monitoring and Tuning the EJB Container
Thread Pool
Commit Option C → Bypass Ready cache to improve performance
Only Transactional
Requests
Single Use Entity
25. Java Persistence and EJB Performance
25
Monitoring and Tuning the EJB Container
Thread Pool
Active Session Beans = 20492 - 19087 = 1405
26. Java Persistence and EJB Performance
26
Monitoring and Tuning the EJB Container
Thread Pool
27. Java Persistence and EJB Performance
27
Monitoring and Tuning the EJB Container
Thread Pool
28. Java Persistence and EJB Performance
28
Monitoring and Tuning the EJB Container
Thread Pool
High Cache hit Ratio = Settings are working well
High Miss Ratio/Passivations = Room for improvement
29. Java Persistence and EJB Performance
29
Monitoring and Tuning the EJB Container
Thread Pool
SNo. Observation Improvement
1 Current PoolSize ~ Max PoolSize
Active Session Beans > Max PoolSize
New Max PoolSize = Active Session
Beans
2 Active Session Beans < Max Pool Size Increase idle timeout
30. Java Persistence and EJB Performance
30
Monitoring and Tuning the EJB Container
Thread Pool - EclipseLink Session Cache
31. Java Persistence and EJB Performance
31
Monitoring and Tuning the EJB Container
Thread Pool - EclipseLink Session Cache
32. Java Persistence and EJB Performance
32
Monitoring and Tuning the EJB Container
Thread Pool - EclipseLink Session Cache
33. Java Persistence and EJB Performance
33
Monitoring and Tuning the EJB Container
Transaction Isolation Level
Sno. Transaction Isolation Level Description
1 ReadUncommitted Read data before transaction completion
2 ReadCommitted Only Commited data is read
3 RepeatableRead Multiple reads within txn return same data
4 Serializable All txns occur in isolation
34. Java Persistence and EJB Performance
34
Monitoring and Tuning the EJB Container
Transaction Isolation Level
LockType Strategy Use Case
Pessimistic Lock Lock row of table Highly Concurrent
Optimistic Lock Use version number Data which is seldom
modified
35. Java Persistence and EJB Performance
35
1. EJB Programming Model
2. The Java Persistence API and Its Reference Implementation
3. Monitoring and Tuning the EJB Container
4. Transaction Isolation Level
5. Best Practices in Enterprise Java Beans
6. Best Practices in Java Persistence
36. Java Persistence and EJB Performance
36
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Container Managed Transaction EJB container manages transaction
Bean Managed Transaction Application manages transaction
Transaction Type
37. Java Persistence and EJB Performance
37
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Use Bean Managed Transaction to narrow the scope of
transaction
Transaction Type
38. Java Persistence and EJB Performance
38
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
SNo. Transaction Attribute Description
1 Required Container executes with client transaction if existent
2 Requires New Container always creates new transaction
3 Mandatory Exception if client not running with transaction
4 Not Supported Client transaction suspended prior to invoking method
5 Supports No transaction created if client transaction non existent
6 Supports New Remote exception if client running with transaction
Transaction Attribute
39. Java Persistence and EJB Performance
39
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Avoid unnecessary transactions by choosing appropriate transaction attributes
Ex: Override Default with Supports attribute
Transaction Attribute
40. Java Persistence and EJB Performance
40
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Control Serialization
Any attribute that does not need to be passivated
should be marked with the transient keyword
41. Java Persistence and EJB Performance
41
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Cache Static Resource References
42. Java Persistence and EJB Performance
42
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Cache Static Resource References
43. Java Persistence and EJB Performance
43
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Use Local instead of Remote References
Local Pass By Reference : Method
Invocations contained within same
JVM
Remote Pass By Value : Argument copying,
Serialization and Deserialization
Overhead
44. Java Persistence and EJB Performance
44
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Use Local instead of Remote References
45. Java Persistence and EJB Performance
45
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Use Local instead of Remote References
46. Java Persistence and EJB Performance
46
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Use Local instead of Remote References
47. Java Persistence and EJB Performance
47
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Use Local instead of Remote References
48. Java Persistence and EJB Performance
48
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Coarse Grained Access
49. Java Persistence and EJB Performance
49
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Lazy Loading or Prefetching
Lazy loading is a strategy used by many persistence
implementations to load a related entity only when it has been
explicitly accessed
50. Java Persistence and EJB Performance
50
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Lazy Loading or Prefetching
Related Entity Line
is Eager Fetched
by Default
51. Java Persistence and EJB Performance
51
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Lazy Loading or Prefetching
52. Java Persistence and EJB Performance
52
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Lazy Loading or Prefetching
53. Java Persistence and EJB Performance
53
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Database Locking Strategy
Use optimistic locking if data is not likely to be modified
frequently by concurrent transactions.
Use pessimistic locking if data is likely to be modified by
concurrent transactions frequently
54. Java Persistence and EJB Performance
54
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Database Locking Strategy
Optimistic Locking
55. Java Persistence and EJB Performance
55
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Database Locking Strategy
Pessimistic Locking
56. Java Persistence and EJB Performance
56
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
EJB Query Language
57. Java Persistence and EJB Performance
57
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
EJB Query Language
58. Java Persistence and EJB Performance
58
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
EJB Query Language
59. Java Persistence and EJB Performance
59
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Read Only Entity Beans
60. Java Persistence and EJB Performance
60
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
EJB 3.0 Best Practices
Use local interfaces over remote interfaces whenever possible. If only
remote interfaces are available use pass by reference in co located
modules to avoid expensive copying of parameters.
61. Java Persistence and EJB Performance
61
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Business Method Interceptors
Interceptors are enterprise bean developer defined
methods that intercept a business method invocation.
An interceptor method can be used for a variety of
purposes including but not limited to validation and
preprocessing of data
62. Java Persistence and EJB Performance
62
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Business Method Interceptors
1. Default invoked for all session bean invocations for all session beans
in a deployment unit
2. Class Level invoked for all method invocations on the session bean they
are bound to
3. Method Level invoked when the method on the session bean is invoked
63. Java Persistence and EJB Performance
63
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Business Method Interceptors : Default
64. Java Persistence and EJB Performance
64
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Business Method Interceptors : Class
65. Java Persistence and EJB Performance
65
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Business Method Interceptors : Method
66. Java Persistence and EJB Performance
66
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Business Method Interceptors : Exclude Method
67. Java Persistence and EJB Performance
67
Monitoring and Tuning the EJB Container
Best Practices - Enterprise Java Beans
Business Method Interceptors : Best Practice
68. Java Persistence and EJB Performance
68
1. EJB Programming Model
2. The Java Persistence API and Its Reference Implementation
3. Monitoring and Tuning the EJB Container
4. Transaction Isolation Level
5. Best Practices in Enterprise Java Beans
6. Best Practices in Java Persistence
69. Java Persistence and EJB Performance
69
Best Practices in Java Persistence
JPA Query Language Queries
1. Named Queries JPA Query Language Query with Name
2. Named Native Queries Static SQL Query with Name
3. Dynamic Queries JPA Language Queries created at runtime
4. Native Queries SQL Query
70. Java Persistence and EJB Performance
70
Best Practices in Java Persistence
JPA Query Language Queries
Named Query
71. Java Persistence and EJB Performance
71
Best Practices in Java Persistence
JPA Query Language Queries
Named Native Query
72. Java Persistence and EJB Performance
72
Best Practices in Java Persistence
JPA Query Language Queries
Dynamic Query
73. Java Persistence and EJB Performance
73
Best Practices in Java Persistence
JPA Query Language Queries
Native Query
74. Java Persistence and EJB Performance
74
Best Practices in Java Persistence
JPA Query Language Queries
Native Query
75. Java Persistence and EJB Performance
75
Best Practices in Java Persistence
JPA Query Language Queries
Pagination Configuration
76. Java Persistence and EJB Performance
76
Best Practices in Java Persistence
Query Results Cache
77. Java Persistence and EJB Performance
77
Best Practices in Java Persistence
Query Results Cache
78. Java Persistence and EJB Performance
78
Best Practices in Java Persistence
Query Results Cache
Use Named Query
Use Pagination
Use Query Results Cache
79. Java Persistence and EJB Performance
79
Best Practices in Java Persistence
Fetch Type
80. Java Persistence and EJB Performance
80
Best Practices in Java Persistence
Fetch Type
81. Java Persistence and EJB Performance
81
Best Practices in Java Persistence
Fetch Type
82. Java Persistence and EJB Performance
82
Best Practices in Java Persistence
Fetch Type
Select the fetchType based on the relationship. Use
eager fetch for entities loaded together. In cases
where related entities may not be loaded together,
use lazy fetch
83. Java Persistence and EJB Performance
83
Best Practices in Java Persistence
Connection Pool
84. Java Persistence and EJB Performance
84
Best Practices in Java Persistence
Bulk Updates
85. Java Persistence and EJB Performance
85
Best Practices in Java Persistence
Bulk Updates
86. Java Persistence and EJB Performance
86
Best Practices in Java Persistence
Bulk Updates
87. Java Persistence and EJB Performance
87
Best Practices in Java Persistence
Choose Correct Locking Strategy
88. Java Persistence and EJB Performance
88
Best Practices in Java Persistence
Read Without Transactions
89. Java Persistence and EJB Performance
89
Best Practices in Java Persistence
Inheritance
1. SINGLE_TABLE Uses one table for all classes and distinguishes between
instance types by using a discriminator column
2. JOINED Uses one table for the root class, and each subclass is
represented by a table that contains attributes specific to the
subclass
3. TABLE_PER_CASS Uses one table per concrete class; this is an optional
strategy and is not required to be implemented by
persistence providers
EJB stands for Enterprise Java beans. It is one of the several Java APIs for standard manufacture of enterprise software
EJB provide inbuilt support for:-
Life-cycle management
Security
Transaction management
Object pooling
There are several types of enterprise Java beans. The list can be seen below:
Session beans
Entity beans
Message-driven beans
Session beans: these are non-persistent enterprise beans. There are two kinds of session beans:
Stateful: a stateful session Bean maintains client-specific session information across several transactions. It exists for the duration of a single client/server session.
Stateless: A stateless session bean is a type of enterprise bean, which is normally used to perform independent operations. A stateless session bean as per its name does not have any associated client state, but it may preserve its instance state
Entity beans: These beans contain persistent data and it can be saved in the data source. There are two types:
Container managed persistence: these entity beans assign their persistence to the EJB container
Bean managed persistence: these entity beans manage their own persistence.
Message-driven beans: Message-driven beans are enterprise beans that receive and process Java message service messages. They can be accessed only through messaging. They do not have interfaces. Asynchronous communication between the queue and the listener takes place
An EJB 2.1 component has a Home interface, a Business interface, and a bean implementation. This is true for both session and entity beans, whereas message driven
beans have only the bean implementation. A Home interface is used by a client to create
an instance of a bean implementation. The Business interface represents the avail-
able business methods in the bean implementation. When a client creates an instance
of a bean using the Home interface, it is returned an instance of the Business interface
by the EJB container. The client then invokes the business method on this implementation of the Business interface
JPA is a layer of abstraction over the database and represents a mapping of db relational schema to java objects which are available for access by the enterprise java beans layer or the business logic layer. This is depicted in this slide
JPA layer consisyd of 5 main classes namely EntityManagerFactory EntityTransaction EntityManager Query and Persistence that provided a programmatic model to interact with the database entities
The relationship between the different JPA entities is shown in this slide
The relationship between the different JPA entities is shown in this slide
Slide in this figure shows the interaction between the persistence context and the session cache
A cache keeps in memory copies of entities stored in the database to expedite entity access. A persistent context (L1 cache) is an integral part of the JPA specifica-
tion. A persistent context can be transactional or extended. A transactional persistent context’s lifetime spans the life cycle of a transaction, whereas an extended persistent
context’s lifetime may span multiple transaction
This slide depicts L1 and L2 caches in JPA. L1 cache holds entities exclusive to transaction while L2 cache holds shared entities
The size of the L2 cache can affect the performance of an application. While an
L2 cache can significantly improve access to entities because it stores in memory
copies of objects retrieved from the database, it can also lead to a large number of
in-memory objects in a heavily used application. This in turn can force the JVM to do
frequent garbage collections to reclaim unused memory, leading to large pause times
and severely degrading the application performance, negating any performance boost
from using caches. On the other hand an underallocated cache may result in objects
being evicted from the cache more often and leading to more trips to the database,
providing little or no benefit from caching. Thus it is important to understand how
to configure the L2 cache for a JPA implementation
This slide depicts L1 and L2 caches in JPA. L1 cache holds entities exclusive to transaction while L2 cache holds shared entities
The size of the L2 cache can affect the performance of an application. While an
L2 cache can significantly improve access to entities because it stores in memory
copies of objects retrieved from the database, it can also lead to a large number of
in-memory objects in a heavily used application. This in turn can force the JVM to do
frequent garbage collections to reclaim unused memory, leading to large pause times
and severely degrading the application performance, negating any performance boost
from using caches. On the other hand an underallocated cache may result in objects
being evicted from the cache more often and leading to more trips to the database,
providing little or no benefit from caching. Thus it is important to understand how
to configure the L2 cache for a JPA implementation
Next we will discuss monitoring and tuning the ejb container
This slide shows the description of glass fish metrics to monitor to tune the threadpool processing an ejb request
This slide shows the asadmin command to view the threadpool metrics for tuning the ejb container
This slide emphasises the importance of threadpool partitioning for beans
This slide shows how to associate a bean with a threadpool in sun ejb.jar.xml file
This slide shows how to view the ejb container properties using asadmin command
This slide shows describes the tunable bean pool properties
This slide shows describes the glass fish command to view bean pool statistics
This slide shows describes the lifecycle of stateless beans
This slide shows the types of bean caches
This slide shows the use of the commit option C for improving performance of beans with only transactional requests or those wchich are used only once.
This slide shows the example of commands to find the number of active stateful sessionbeans.
This slide shows the example of commands to find the number of cache hits and misses
This slide shows the example of computation of cache hit ratio
This slide shows the example of computation of cache hit ratio
This slide shows the specific steps to improve performance of EJB containers
This slide shows the eclipse link configuration to print cache statistics
This slide shows the cache statistics of number of hits and misses of Customer and Order entities.
This slide shows the option to change the size of cache in eclipse link
This slide describes various transaction isolation levels
This slide describes difference between pessimistic and optimistic lock and their use cases
Next we will discuss monitoring and tuning the ejb container
This slide describes different transaction types in enterprise java beans
This slide describes use of bean managed transaction to narrow the scope of transaction
This slide describes various transaction attributes
This slide describes use of the supports attribute to override default required transaction in ejb
This slide describes use of the transient attribute to control serialization overhead
This slide describes caching of the ejb session
This slide describes 10% improvement in performance if static resources are cached
This slide describes difference between local and remote references
The reference to a local interface is defined in the web.xml as shown in this slide
The EJB module exposes the session bean’s local interfaces with the declaration in the ejb-jar.xml as shown in this slide
The pass-by-reference configuration is done for individual enterprise beans in
the sun-ejb-jar.xml. For example, the ServletDriver invokes the remote method
of OrderSessionBean enterprise bean co-located on the same JVM, and if we still
wanted to pass parameters by-reference instead of by-value, we would use the entry in the sun-ejb-jar.xml as shown in this slide
As shown in this slide there is an 11% difference between the Local and Remote interface scenarios
This slide shows an example of usage of coarse grained access
In the Session Façade design pattern, the server encapsulates multiple smaller tasks into one business operation. The client, instead
of making multiple remote invocations makes one invocation to complete the business operation.
In the code shown placeOrder method of the CheckoutSession Class makes multiple method invocations to place an order
This slide shows an example of usage of coarse grained access
In the Session Façade design pattern, the server encapsulates multiple smaller tasks into one business operation. The client, instead
of making multiple remote invocations makes one invocation to complete the business operation.
In the code shown placeOrder method of the CheckoutSession Class makes multiple method invocations to place an order
This slide shows an example that specifies the fetch group in the sun-cmp-mappings.xml file
This slide shows that the throughput of the eager scenario is 38% of the lazy scenario
This slide shows that the throughput of the eager scenario is 38% of the lazy scenario
This slide shows that the throughput of the eager scenario is 38% of the lazy scenario
1. Create a version column with numeric data type in the primary table
representing the entity bean in the database.
2. Create triggers on the version column so that each time the database row is
updated, the row’s version column is incremented.
3. In the sun-cmp-mappings.xml file specify the following under the
<consistency> element
In the sun-cmp-mappings.xml file specify the following under the
<consistency> element
This slide shows the use of findbyPrimaryKey to fetch order entity
This slide shows the use of EJBQL to fetch orderLine items from db
This slide shows the performance benefit of using EJB QL. In this example, the throughput when using
the findByPrimaryKey scenario is only 22% of using EJB QL
The example in this slide shows configuring a rarely changing entity bean as read-only. The refresh-period-in-seconds parameter is the number of seconds before
the state of the entity instance is reloaded from the database
This slide describes the best practice to use local interfaces over remote interfaces
This slide describes interceptor methods
This slide describes the different level of granularity of interceptor methods.
This slide describes deployment descriptor for default interceptor
This slide describes deployment descriptor for class level interceptor
This slide describes deployment descriptor for method level interceptor
This slide describes deployment descriptor to exclude themethod of a class from default interceptor and class interceptor invocation
This slide describes best practice to use appropriate granularity when using interceptor to prevent performance degradation
Next we will discuss best practices in Java Persistence
Next we will discuss monitoring and tuning the ejb container
Since these queries do not change, most JPA implementations precompile the queries during deployment. These queries support parameter
binding. The example in this slide shows a NamedQuery used to look up an Order entity based on a Customer’s id
The example in this slide shows a Name NativeQuery version of the preceding NamedQuery using a resultClass to map
the returned result set to an Order entity. Disadvantage =Less portable
Dynamic queries are JPA Language Queries created at runtime. The example in this slide shows a query not parameterized and is compiled on each invocation.
Dynamic queries are JPA Language Queries created at runtime. The example in this slide shows a query not parameterized and is compiled on each invocation.
Slide shows the performance of named, named native, dynamic parameterized, and dynamic non parameterized queries. There is a distinct advantage in using named queries or parameterized dynamic queries whenever possible, as the JPA provider can skip the compilation stage during runtime and uses the precompiled queries from its cache
An application can control how much data is retrieved from database and can significantly improve performance in cases where a large col-
lection is retrieved from the database
Most JPA implementations support caching of named query results. If a named query
is executed with the same parameters and the query results cache is enabled, the
persistence provider returns the results from the query results cache, saving a trip
to the database
This Slide shows an example of configuring a query results cache
for the Order entity in the orm.xml file
The orm.xml in the preceding example configures a query results cache for the
query named “findByStatus”, which stores the last 200 result sets of distinct
parameters
Hint specification to expires the cache every 30 minutes and forces the query to execute on the database.
Hint specification to refresh the session cache if the data received from the database by a query is newer than the data in the cache
It is a good performance practice to use named query whenever possible. Use pagination to restrict the number of entities retrieved from the database. Use a query results cache for named queries where applicable
A FetchType of LAZY benefits entities with one-to-many or many-to-many rela-
tionships, where the cardinality of the relationship is high, and the attributes are not
accessed immediately after the entity is loaded.
Figure in slide shows the performance of loading an Order entity with a 1:M relationship with OrderLine entity. The mean
cardinality of the relationship is around 50.
The eager and lazy fetch relationship between the Order entity and the OrderLine entity is marked as shown in this slide
The named query in the preceding example when executed fetches the related OrderLine objects along with the Order object with a specific status. The LEFT keyword specifies that an order should be fetched even if it doesn’t contain any related OrderLine objects
This slide describes when to use lazy or eager fetch types
It is important to set the connection pool to number of request processing threads
This slide shows that with connection pool size of 4, the throughput
is 76% of the throughput with a connection pool size of 12. This is because in the case
of the connection pool of size 4, the request processing threads are waiting to get a
connection from the connection pool
Consider the following example that cancels all orders belonging to a customer. This implementation would result in as many SQL statements as there
are orders in the Collection returned by the query execution.
We can write the same implementation with a JPA QL query that updates the status on the orders with a single SQL query
Figure in slide shows the performance of iterative versus bulk update for a customer that has on average ten orders associated with it. The throughput of an iterative update is 20% of the throughput achievable through a JPA QL bulk update
The example in this slide demonstrates how to configure optimistic locking. Use of optimistic locking improves performance in cases where data is seldom modified
To prevent the overhead of a new transaction on a read only method, use the supports transaction attribute on method.
In the example in this slide, if the client code does not invoke the getOrder()
method in a transaction, the em.find() method looks up the appropriate Order instance without a transaction
There are three strategies in the Java Persistence 1.0 specification for mapping inheritance hierarchy to database tables
The JOINED inheritance strategy is not necessarily a bad choice with respect to performance.In the case of inheri-
tance using the JOINED strategy the cardinality of the relationship is always one,
and looking up single records using the primary key across tables through indexes,
which most databases automatically provide for records using their primary key,
makes no perceptible difference in performance