EJB 3.0 simplifies Java EE application development by reducing the number of required interfaces and classes. It utilizes annotations for configuration and dependency injection to reduce boilerplate code. The new persistence API allows entities to be simple POJOs and supports pluggable providers. Existing EJB 2.1 applications continue to work with EJB 3.0, and migration can be done incrementally to reduce the number of files and lines of code.
Overview of EJB technology.
Enterprise Java Beans (EJB) is a server-side component technology for Java EE based systems (JEE).
Beans are business logic components that implement a standard interface through which the bean is hooked into the bean container (= runtime object for bean).
A Java class implementing one of the standard bean interfaces is an Enterprise Java Bean. Beans can be accessed remotely, usually from a client tier.
The EJB standard was developed to provide a common framework for solving recurring problems in business application development like persistence, transactions,
security and runtime and lifecycle management. The EJB standard evolved greatly over time. EJB version 1 and 2 were complex and required to implement many interfaces
and exception handling in EJBs. EJB version 3 brought great simplifications and did away with interfaces by replacing these with annotations which provide greater flexibility while keeping complexity low. EJBs come in 3 different flavors: Stateless and stateful session beans and message driven beans. Entity beans of EJB version 1 and 2 were replaced by the Java Persistence API in EJB version 3.
Enterprise Java Beans (EJB) is a platform for building portable, reusable, and scalable business applications using the Java programming language.
EJB allows application developers to focus on building business logic without having to spend time on building infrastructure code for services such as transactions, security, automated persistence, and so on.
This presentation introduces EJB 3.0 concepts with code examples.
Quontra Solutions is leading provider of IT career advice, Training and consulting services for IT Professional and corporates across USA. We train individuals or Corporate via online or class Room training in all IT tools and Technologies.
We always strive to bring out innovative methods along with the traditional teaching techniques which enhance the overall experience of the students and teachers to extract the return on Investments, high efficiency and scalability.
The company’s architecture is based on the insights from the marketplace, business analytics and strategies keeping intact the fundamental principles in mind, helps us to compete and win in today’s environment without changing any quality in training.
The support, service and training provided by Quontra solutions for various customers assures a “stay up to date” easy transition from previous to current in terms of technology. Our advertisers and promoters are none other than the clients you have been associated with us for their training needs. We improve our training programs from the feedback from the students.
Email Id : info@quontrasolutions.co.uk
Website: http://www.quontrasolutions.co.uk
In this session I have described the different types of dependency injections and their usages.
Reference Link : http://en.wikipedia.org/wiki/Dependency_injection
Overview of EJB technology.
Enterprise Java Beans (EJB) is a server-side component technology for Java EE based systems (JEE).
Beans are business logic components that implement a standard interface through which the bean is hooked into the bean container (= runtime object for bean).
A Java class implementing one of the standard bean interfaces is an Enterprise Java Bean. Beans can be accessed remotely, usually from a client tier.
The EJB standard was developed to provide a common framework for solving recurring problems in business application development like persistence, transactions,
security and runtime and lifecycle management. The EJB standard evolved greatly over time. EJB version 1 and 2 were complex and required to implement many interfaces
and exception handling in EJBs. EJB version 3 brought great simplifications and did away with interfaces by replacing these with annotations which provide greater flexibility while keeping complexity low. EJBs come in 3 different flavors: Stateless and stateful session beans and message driven beans. Entity beans of EJB version 1 and 2 were replaced by the Java Persistence API in EJB version 3.
Enterprise Java Beans (EJB) is a platform for building portable, reusable, and scalable business applications using the Java programming language.
EJB allows application developers to focus on building business logic without having to spend time on building infrastructure code for services such as transactions, security, automated persistence, and so on.
This presentation introduces EJB 3.0 concepts with code examples.
Quontra Solutions is leading provider of IT career advice, Training and consulting services for IT Professional and corporates across USA. We train individuals or Corporate via online or class Room training in all IT tools and Technologies.
We always strive to bring out innovative methods along with the traditional teaching techniques which enhance the overall experience of the students and teachers to extract the return on Investments, high efficiency and scalability.
The company’s architecture is based on the insights from the marketplace, business analytics and strategies keeping intact the fundamental principles in mind, helps us to compete and win in today’s environment without changing any quality in training.
The support, service and training provided by Quontra solutions for various customers assures a “stay up to date” easy transition from previous to current in terms of technology. Our advertisers and promoters are none other than the clients you have been associated with us for their training needs. We improve our training programs from the feedback from the students.
Email Id : info@quontrasolutions.co.uk
Website: http://www.quontrasolutions.co.uk
In this session I have described the different types of dependency injections and their usages.
Reference Link : http://en.wikipedia.org/wiki/Dependency_injection
In this presentation Skillwise provides you the Cobol Programming Basics. COBOL is primarily used in business, finance, and administrative systems for companies and governments.
Health care or healthcare is the maintenance or improvement of health via the diagnosis, treatment, and prevention of disease, illness, injury, and other physical and mental impairments in human beings
Manufacturing is the production of merchandise for use or sale using labour and machines, tools, chemical and biological processing, or formulation. The term may refer to a range of human activity, from handicraft to high tech, but is most commonly applied to industrial production, in which raw materials are transformed into finished goods on a large scale.
Logistics is the function of making goods and other resources physically available for use as and when required. This generally includes two basic activities of moving or transporting these resources, and storing them at different location till required for use or further transportation.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
4. What is EJB?
A server side component architecture for the development
and deployment of distributed, enterprise applications in
Java.
Typically contain the business logic of an enterprise
application
EJB applications are scalable, transactional, multi-user and
secure.
EJB components are managed by the EJB container that is
part of a Java EE server
6. Advantages of EJB
Write Once, Deploy Anywhere
Frees the application developer from having to deal
with the system level aspects of an application.
Behavior can be configured at deployment without
modifying the source code
Rapid and simplified development of distributed,
transactional, secure and portable Java EE applications
7. Types of EJBs
Session Bean
Stateful Session Bean
Stateless Session Bean
Entity Bean
• Based on persistence types,
Bean managed
Container managed
Message Driven Bean
8. An EJB 2.1 Example
8
// Bean class
public class HelloBean implements SessionBean {
private SessionContext sessionContext;
public void ejbCreate() { }
public void ejbRemove() { }
public void ejbActivate() { }
public void ejbPassivate() { }
public void setSessionContext(SessionContext sessionContext) {
this.sessionContext = sessionContext;
}
public String sayHello() {
return "Hello World!!!!!";
}
}
// Home Interface
public interface HelloHome extends EJBHome {
public Hello create() throws RemoteException, CreateException;
}
// Remote Interface
public interface Hello extends EJBObject {
public String sayHello() throws RemoteException;
}
9. An EJB 2.1 Example (Contd.)
9
// Entry in ejb-jar.xml (deployment descriptor)
<session>
<ejb-name>Hello</ejb-name>
<home>com.jlive.demo.hello.HelloHome</home>
<remote>com.jlive.demo.hello.Hello</remote>
<ejb-class>com.jlive.demo.hello.HelloBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
</session>
//Client code
public class HelloClient {
public static void main(String [] args) throws Exception {
Context jndiContext = new InitialContext();
Object ref = jndiContext.lookup("Hello");
HelloHome helloHome = (HelloHome)
PortableRemoteObject.narrow(ref,
HelloHome.class);
Hello hello = helloHome.create();
System.out.println(hello.sayHello());
}
}
10. What was wrong with EJB 2.1?
EJB 2.1 technology
Very powerful, but complex to use
Too many classes, interfaces
Java Naming and Directory Interface™(JNDI) API lookups
javax.ejb interfaces
Awkward programming model
Deployment descriptors
Entity bean anti-patterns
Difficult to test entities outside the container
11. EJB 3.0 - What’s New ?
Simplification of the EJB APIs
Utilizes advantages of Java metadata annotations
More work is done by container, less by developer
Dependency injection
New Persistence API Specification
12. EJB 3.0 Bean Simplification
Elimination of EJB component interfaces
Business interfaces are plain Java interfaces
Elimination of Home interfaces
Only need business interface, not home
Elimination of requirements for
javax.ejb.EnterpriseBean interfaces
Annotations for (optional) callbacks
Elimination of need for use of JNDI API
Use dependency injection, simple lookup method
13. Example – EJB 3.0
13
// Bean class
@Stateless
public class NewHelloBean implements NewHello{
public String sayHello() {
return "Hello New World!!!!!";
}
}
// Business Interface
@Remote
public interface NewHello {
public String sayHello();
}
// Client code
public class NewHelloClient
{
public static void main(String [] args) throws Exception {
Context jndiContext = new InitialContext();
Object ref = jndiContext.lookup("NewHello");
NewHello hello = (NewHello)ref;
System.out.println(hello.sayHello());
}
}
14. MDB in EJB 3.0
14
@MessageDriven(activateConfig = {
@ActivationConfigProperty(propertyName="destinationTy
pe", propertyValue="javax.jms.Queue"),
@ActivationConfigProperty(propertyName="destination",
propertyValue="queue/mdb") })
public class CalculatorBean implements MessageListener {
public void onMessage (Message msg) {
try {
TextMessage tmsg = (TextMessage) msg;
} catch (Exception e) { e.printStackTrace (); } }
// ... ... }
Message driven beans are components designed to handle
message based requests
The MDB must implement the Message Listener interface.
The on Message method is invoked when a message is
received by the container
15. Resource Injection
Resource injection is an inversion of dependency
Resources can be injected on bean creation
References of
DataSources, UserTransaction, Environment entries,
EntityManager, Other EJB beans
Annotations
@EJB
@Resource
Injection can be specified using deployment descriptor
19. EJB 3.0 Transactions
19
CMT by default, BMT by annotation
Specified at class level or method level
Default is CMT + REQUIRED
20. • // Uses container-managed transaction, REQUIRED attribute
• @Stateless public PayrollBean implements Payroll {
• @TransactionAttribute(MANDATORY)
• public void setBenefitsDeduction(int empId, double
deduction) {...}
• public double getBenefitsDeduction(int empId) {...}
• public double getSalary(int empid) {...}
• @TransactionAttribute(REQUIRES_NEW)
• public void setSalary(int empId, double salary) {...}
• }
21. EJB 3.0 Security
21
Security configuration preferred at deployment
Annotations - @Unchecked, @RolesAllowed
Default is unchecked
// Security view
@Stateless public PayrollBean implements Payroll {
public void setBenefitsDeduction(int empId, double deduction)
{...}
public double getBenefitsDeduction(int empId) {...}
public double getSalary(int empid) {...}
// salary setting is intended to be more restricted
@RolesAllowed(“HR_PayrollAdministrator”)
public void setSalary(int empId, double salary) {...}
}
22. EJB 3.0 Callback - Event Notification
22
Container calls bean upon lifecycle events
@PostConstruct, @PreDestroy, @PrePassivate, @PostActivate,…
Bean specifies events it needs to know about
Callback methods can be specified on lifecycle listener
24. EJB 3.0 Interceptors
Interception of invocations of business methods and/or
message listener methods
Invocation model: “around” methods
Wrapped around business method invocations
Interceptor has control over invocation of “next method”
Can manipulate arguments and results
Context data can be carried across invocation chain
Execute in specified order
Can use deployment descriptor to override order or add
interceptors
Annotations
@Interceptors, @AroundInvoke
25. EJB 3.0 Interceptors - Example
25
@Interceptors({
com.demo.AuditInterceptor.class,
com.demo.LoggerInterceptor.class
})
@Stateless
public class AccountManagementBean implements
AccountManagement {
public void createAccount(int accountId, Details
details) {...}
public void deleteAccount(int accountId) {...}
}
public class AuditInterceptor {
@AroundInvoke
public Object
auditOperation(InvocationContext inv) {
try {
Object result = inv.proceed();
// Add auditing code here
return result;
} catch (Exception ex) {
…
}
}
26. Persistence API
26
Can be used outside Java EE platform-based containers
also
Evolution into “common” Java persistence API
Support for pluggable third-party persistence providers
27. Persistence Model
27
Entities are simple Java classes
Concrete java classes
No required interfaces
Usable as “detached” objects in other tiers
No more need for DTOs
EntityManager is used to manage entities
Creates, removes and finds entities
Usable across multiple transactions, spanning multiple
user requests
Extended persistence context
28. EJB 3.0 Entity - Example
28
Order.java
@Entity
@Table(name="ORDER_TABLE")
public class Order {
@Id
@GeneratedValue
protected long orderId;
@OneToOne
protected Item item;
...
}
Item.java
@Entity
public class Item {
protected long SKU;
@Id
@GeneratedValue
public long getSKU() { return SKU; }
}
29. Entity Manager
29
Provides entity operations
Methods for lifecycle operations
Persist, remove, merge, flush, refresh, etc.
Convenience query methods (find)
EntityManager is factory for Query objects
Static (named) and dynamic queries, EJB QL and SQL
queries
Manages persistence context
Both transaction-scoped and extended persistence
contexts
Similar in functionality to Hibernate Session, JDO
PersistenceManager, etc.
30. EJB 3.0 Entity Manager- Example
30
// Creating the entity
public void createNewOrder(Order order){
EntityManager em = getEntityManager();
try{
em.getTransaction().begin();
em.persist(order);
em.getTransaction().commit();
}
finally{ em.close(); } }
// Finding and updating the entity
public void alterOrderQuantity(long orderId, int
newQuantity){
EntityManager em = getEntityManager();
try{
em.getTransaction().begin();
Order order = em.find(Order.class,
orderId);
order.setQuantity(newQuantity);
em.getTransaction().commit();
}finally{ em.close(); } }
31. 31
Named queries are predefined static queries that are precompiled.
They can take parameters, but the query remains the same.
@NamedQuery(
name="MyEntity.getItemsPerProductCategory",
query="SELECT i FROM Item i WHERE i.product.categoryID
LIKE :cID"
)
@Entity
public class MyEntity { ...
}
// Using named queries
public class MyDataFacade ... {
private EntityManager em;
...
public List<Items> getItems(String catID) {
Query query =
em.createNamedQuery("MyEntity.getItemsPerProduct
Category");
query.setParameter("cID",catID);
List<Item> items = query.getResultList();
return items;
}
32. EJB – Compatibility and
Migration
32
Existing applications continue to work
Provides integration with existing applications and
components
Allows components to be updated or replaced (using
EJB 3.0 APIs) without affecting existing clients
Facilitates EJB 3.0 technology adoption with
incremental migration
33. Migrating EJB 2.1 to EJB 3.0
33
0
2
4
6
8
10
12
14
16
18
# of Java Files # of XML Files
EJB 2.1
EJB 3.0
No. of files EJB
2.1
EJB
3.0
Java Files 17 7
XML Files 9 2
Migration of the RosterApp, available as a sample
application in public domain
No. of files comparison %
41%
22%
34. Migrating EJB 2.1 to EJB 3.0
34
Lines of Code
in
EJB2.1 EJB3.0 %
Java File 987(17) 716(7) 73%
XML File 792(9) 26(2) 3%
Migration of the RosterApp, available as a sample
application in public domain
LOC comparison
0
100
200
300
400
500
600
700
800
900
1000
# of lines (Java) # of lines (XML)
EJB 2.1
EJB 3.0
35. EJB 3.0 Summary
35
EJB technology simplified for developers
Fewer classes and interfaces
Injection model for container services and resources
Removal of boilerplate code
Elimination of need for deployment descriptors
Independent Persistence specification
Entities are POJOs enabling detached entities
Improved query capabilities
O/R mapping specification
EJB 3.0 applications interoperate with existing applications
36. Resources
• JSR 220: Enterprise JavaBeans™,Version 3.0
EJB 3.0 Simplified API
EJB Core Contracts and Requirements
Java Persistence API
• Enterprise JavaBeans Technology
http://java.sun.com/products/ejb/
• EJB
http://dev2dev.bea.com/ejb/
• The Simplicity of EJB 3.0/
http://java.sys-con.com/read/117755_1.htm
36