0% found this document useful (0 votes)
25 views35 pages

UNIT 4 5 je

edg ret mjrggfhn h ghngg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views35 pages

UNIT 4 5 je

edg ret mjrggfhn h ghngg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

UNIT 4

1 Write short note on Enterprise Bean Server and Enterprise Bean. (APR 2019)
● An Enterprise Bean Server
o EJB SERVER
o The EJB server (also known as the J2EE application server) is the outermost
container of the various elements that make up an EJB environment. The EJB
server manages one or more EJB containers and provides required support
services, such as transaction management, persistence, and client access. A
JNDI-accessible naming space can be used by clients to locate the EJB.
o 3 tire architecture : ui, business rules, database
o Features : security, threading, connection polling
● Enterprise Bean Containers that runs on these servers
o Manage enterprise bean inside it.
● It provides registration of objects, remote interface, security, transaction
▪ Enterprise Beans that run in these containers
● Its reusable classes (add to cart) logic or emi calculator
▪ Enterprise Bean Clients
● Its standalone application for user interaction (atm machine)
▪ Other systems such as Java Naming and Director Interface [JNDI] and Java
Transaction Service [JTS]
o An EJB component can have remote and local interfaces. Clients not located in
the same application server instance as the bean (remote clients) use the
remote interface to access the bean. Calls to the remote interface require
marshalling arguments, transportation of the marshalled data over the network,
un-marshaling the arguments, and dispatch at the receiving end.
o If an EJB component has a local interface, then local clients in the same
application server instance can use it instead of the remote interface. Using the
local interface is more efficient, since it does not require argument marshalling,
transportation, and un-marshalling.
o Entity Beans
o always have states
o may be shared by multiple EJB Clients
o their states can be persisted and stored across multiple invocations
o survive server shutdown/crash
o encapsulate in their object reference a unique ID that points to their state
2 Describe Packaging of Enterprise Beans in JAR and WAR Modules. (APR 2019)
● Packaging Enterprise Beans
o An EJB JAR file is portable and can be used for various applications.
o To assemble a Java EE application, package one or more modules, such as EJB
JAR files, into an EAR file, the archive file that holds the application. When
deploying the EAR file that contains the enterprise bean's EJB JAR file, you also
deploy the enterprise bean to GlassFish Server. You can also deploy an EJB JAR
that is not contained in an EAR file

o Packaging Enterprise Beans in WAR Modules


o Enterprise beans often provide the business logic of a web application. In
these cases, packaging the enterprise bean within the web application's WAR
module simplifies deployment and application organization. Enterprise beans
may be packaged within a WAR module as Java programming language class
files or within a JAR file that is bundled within the WAR module.
o To include enterprise bean class files in a WAR module, the class files should
be in the WEB-INF/classes directory.o To include a JAR file that contains
enterprise beans in a WAR module, add the JAR to the WEB-INF/lib directory of
the WAR module. o WAR modules that contain enterprise beans do not require
an ejb-jar.xml deployment descriptor. If the application uses ejb-jar.xml, it must
be located in the WAR module's WEB-INF directory. o JAR files that contain
enterprise bean classes packaged within a WAR module are not considered EJB
JAR files, even if the bundled JAR file conforms to the format of an EJB JAR file.
The enterprise beans contained within the JAR file are semantically equivalent
to enterprise beans located in the WAR module's WEB-INF/classesdirectory, and
the environment namespace of all the enterprise beans are scoped to the WAR
module.
3 How to access No-Interface View and Local Business Interface? (APR 2019)
● Accessing Enterprise Beans
o Clients access enterprise beans either through a no-interface view or through
a business interface.
o A no-interface view of an enterprise bean exposes the public methods of the
enterprise bean implementation class to clients. Clients using the no-interface
view of an enterprise bean may invoke any public methods in the enterprise
bean implementation class or any superclasses of the implementation class.
▪ To obtain a reference to the no-interface view of an enterprise bean through
dependency injection, use the javax.ejb.EJB annotation and specify the
enterprise bean’s implementation class.
o A business interface is a standard Java programming language interface that
contains the business methods of the enterprise bean.
▪ To obtain a reference to the local business interface of an enterprise bean
through dependency injection, use the javax.ejb.EJB annotation and specify
the enterprise bean’s local business interface name.
o Accessing Interfaces
o Accessing Local Enterprise Beans Using the No-Interface View
o Client access to an enterprise bean that exposes a local, no-interface view is
accomplished through either dependency injection or JNDI lookup. To obtain a
reference to the no-interface view of an enterprise bean through dependency
injection, use the javax.ejb.EJB annotation and specify the enterprise bean’s
implementation class: ▪ @EJB ▪ ExampleBean exampleBean;
▪ To obtain a reference to the no-interface view of an enterprise bean through
JNDI lookup, use the javax.naming.InitialContext interface’s lookupmethod:
▪ ExampleBean exampleBean = (ExampleBean)
▪ InitialContext.lookup("java:module/ExampleBean");
▪ Clients do not use the new operator to obtain a new instance of an enterprise
bean that uses a no-interface view.
o Accessing Local Enterprise Beans That Implement Business Interfaces
o Client access to enterprise beans that implement local business interfaces is
accomplished through either dependency injection or JNDI lookup.
o To obtain a reference to the local business interface of an enterprise bean
through dependency injection, use the javax.ejb.EJB annotation and specify the
enterprise bean’s local business interface name: ▪ @EJB ▪ Example example;
▪ To obtain a reference to a local business interface of an enterprise beanthrough
JNDI lookup, use the javax.naming.InitialContext interface lookupmethod:
▪ ExampleLocal example = (ExampleLocal)
▪ InitialContext.lookup("java:module/ExampleLocal");
4 Explain benefits of EJB. (NOV 2019)
What is EJB? Explain its advantages. (NOV 2022)
What are the benefits of Enterprise Java Bean? (APR 2023)

● an enterprise bean is a server-side component that encapsulates the


business logic of an application. The business logic is the code that
fulfills the purpose of the application. In an inventory control
application, for example, the enterprise beans might implement the
business logic in methods called checkInventoryLevel and
orderProduct. By invoking these methods, clients can access the
inventory services provided by the application.
● Benefits of Enterprise Beans ● For several reasons, enterprise beans
simplify the development of large, distributed applications.
o First, because the EJB container provides system-level services to
enterprise beans, the bean developer can concentrate on solving
business problems. The EJB container, rather than the bean developer,
is responsible for system-level services such as transaction
management and security authorization.
o Second, because the beans rather than the clients contain the
application’s business logic, the client developer can focus on the
presentation of the client. The client developer does not have to code
the routines that implement business rules or access databases. As a
result, the clients are thinner, a benefit that is particularly important
for clients that run on small devices.
o Third, because enterprise beans are portable components, the
application assembler can build new applications from existing beans.
These applications can run on any compliant Java EE server provided
that they use the standard APIs
5 Explain about enterprise bean container. (NOV 2018)
● Java EE Containers
o Normally, thin-client multitiered applications are hard to write
because they involve many lines of intricate code to handle
transaction and state management, multithreading, resource pooling,
and other complex low-level details. The component-based and
platform- independent Java EE architecture makes Java EE applications
easy to write because business logic is organized into reusable
components. In addition, the Java EE server provides underlying
services in the form of a container for every component type. Because
you do not have to develop these services yourself, you are free to
concentrate on solving the business problem at hand.
o Container Services
**▪ Containers are the interface between a component and the low-
level platform-specific functionality that supports the component.
Before a web, enterprise bean, or application client component can be
executed, it must be assembled into a JavaEE module and deployed
into its container.*****▪ The assembly process involves specifying
container settings for each component in the Java EE application and
for the Java EE application itself. Container settings customize the
underlying support provided by the Java EE server, including services
such as security, transaction management, Java Naming and Directory
Interface (JNDI) lookups, and remote connectivity. Here are some of
the highlights: ****● The Java EE security model lets you configure a
web component or enterprise bean so that system resources are
accessed only by authorized users. ****● The Java EE transaction
model lets you specify relationships among methods that make up a
single transaction so that all methods in one transaction are treated as
a single unit. ****● JNDI lookup services provide a unified interface to
multiple naming and directory services in the enterprise so that
application components can access these services.
6 Write a note on Enterprise Bean Architecture. (APR 2023)
● Enterprise Bean Architecture
● Enterprise applications are complex, used by many users, developed by
multiple teams, anddeployed on heterogeneous systems that might span
multiple environments. In addition, enterprise applications have to be
distributed, secure, transactional, reliable, scalable, flexible,
expandable, reusable, and manageable. Moreover, enterprise applications must
be integrated with existing systems, and leveraged against the existing
infrastructure.
● Enterprise JavaBeans (EJB) is a component-based architecture for developing,
deploying, and managing reliable enterprise applications in production
environments. EJB architecture is at the heart of the Java 2 platform, Enterprise
Edition (J2EE). With the growth of the Web and the Internet, more and more
enterprise applications are now Web based, including both intranet and
extranet applications. Together, the J2EE and EJB architectures provide superior
support for Web-based enterprise applications.
● Enterprise Bean architecture defines a model for the development and
deployment of reusable Java sever components. EJB component architecture is
the backbone of the java EE platform
o EJB Architecture is composed of
▪ An Enterprise Bean Server
● EJB SERVER
● The EJB server (also known as the J2EE application server) is the outermost
container of the various elements that make up an EJB environment. The EJB
server manages one or more EJB containers and provides required support
services, such as transaction management, persistence, and client access. A
JNDI-accessible naming space can be used by clients to locate the EJB.
● 3 tire architecture : ui, business rules, database
● Features : security, threading, connection polling
▪ Enterprise Bean Containers that runs on these servers
● Manage enterprise bean inside it.
● It provides registration of objects, remote interface, security, transaction
▪ Enterprise Beans that run in these containers
● Its reusable classes (add to cart) logic or emi calculator
▪ Enterprise Bean Clients
● Its standalone application for user interaction (atm machine)
▪ Other systems such as Java Naming and Director Interface [JNDI] and Java
Transaction Service [JTS]
▪ Java EE Containers
o Normally, thin-client multitiered applications are hard to write because they
involve many lines of intricate code to handle transaction and state
management, multithreading, resource pooling, and other complex low- level
details. The component-based and platform-independent Java EE architecture
makes Java EE applications easy to write because business logic is organized into
reusable components. In addition, the Java EE server provides underlying
services in the form of a container for every component type. Because you do
not have to develop these services yourself, you are free to concentrate on
solving the business problem at hand.
o Container Services
o Containers are the interface between a component and the low-level
platform-specific functionality that supports the component. Before
a web, enterprise bean, or application client component can be
executed, it must be assembled into a Java EE module and deployed
into its container.
o The assembly process involves specifying container settings for each
component in the Java EE application and for the Java EE application
itself. Container settings customize the underlying support provided
by the Java EE server, including services such as security, transaction
management, Java Naming and Directory Interface (JNDI) lookups,
and remote connectivity. Here are some of the highlights:
o The Java EE security model lets you configure a web component
or enterprise bean so that system resources are accessed only by
authorized users.
o The Java EE transaction model lets you specify relationships among methods
that make up a single transaction so that all methods in one transaction are
treated as a single unit.
o JNDI lookup services provide a unified interface to multiple naming and
directory services in the enterprise so that application components can access
these services.
o An EJB component can have remote and local interfaces. Clients not located in
the same application server instance as the bean (remote clients) use the
remote interface to access the bean. Calls to the remote interface require
marshalling arguments, transportation of the marshalled data over the network,
un-marshaling the arguments, and dispatch at the receiving end.
7 What are the different types of beans? Explain. (NOV 2018)
● Types of Enterprise Beans
***o Session Beans *** o associated with one EJB Client***o created and
destroyed by the particular EJB Client***o nonpersistant, do not survive a server
shutdown/crash.***o obviously used to model some service***o Two types of
session beans exist: stateful and stateless
▪ Stateless Session Beans
● have no internal state ● since they do not have any states, they need not be
passivated ● instances can be pooled to service multiple clients
▪ Stateful Session Beans
● have internal state ● need to handle activation and passivation
● an instance of stateful bean is dedicated to the client that created it
● may survive client session - a persistent handle to the bean may be
obtained, saved at the client side and later (possibly when a client is
started next time) converted back to the reference to the original
session bean
▪ Singleton Session Beans
● A Singleton Session Bean maintains the state of the bean for the complete
lifecycle of the application.
● Singleton Session Beans are similar to Stateless Session Beans but only one
instance of the Singleton Session Bean is created in the whole application and
does not terminates until the application is shut down.
● The single instance of the bean is shared between multiple clients and
can be concurrently accessed.
o Entity Beans o always have states
o may be shared by multiple EJB Clients o their states can be persisted and
stored across multiple invocations o survive server shutdown/crash
o encapsulate in their object reference a unique ID that points to their state
o Message Driven Beans o Message driven beans are the light weight
components used for communication. In message driven beans the messaging
service is in asynchronous mode because the user is not intended to get the
instant result.
▪ Message driven beans are the special type of components that can receive the
JMS as well as other type of messages.
▪ Message driven bean can also be used to receive the messages other than JMS.
▪ When a message is reached at the destination then the EJB container invokes
8 Write a note on different types of session beans. (NOV 2019)
Write a detailed note on the type of Session beans. (NOV 2022)
Write a note on: (APR 2023)
1. Stateful Session Bean
2. Stateless Session Bean
There are 3 types of session bean.
1) Stateless Session Bean: It doesn't maintain state of a client between multiple
method calls.********o A stateless session bean does not maintain a
conversational state with the client. When a client invokes the methods of a
stateless bean, the instance of bean variables may contain a state specific to that
client only for the duration of a method invocation******.o Once the method is
finished, the client-specific state should not be retained i.e. the EJB container
destroys a stateless session bean*******.o Stateless session beans can support
multiple clients, they provide the better scalability for applications that require
large numbers of clients.******o Life Cycle of a Stateless Session
Bean:*******o Since the Stateless session bean does not passivates across
method calls****** therefore a stateless session bean includes only two stages.
Whether it does not exist or ready for method invocation. A stateless session
bean starts its life cycle when the client first obtains the reference of the session
bean. For this, the container performs the dependency injection before invoking
the annotated @PreConstruct method if any exists. After invoking the annotated
@PreConstruct method the bean will be ready to invoke its method by the
client******o The container calls the annotated @PreDestroy method while
ending the life cycle of the session bean. After this,

the bean is ready for garbage collection.******* 2) Stateful Session Bean: It


maintains state of a client across multiple requests.*******o These types of
beans use the instance variables that allows the data persistent across method
invocation because the instance variables allow persistence of data across
method invocation.*****o The client sets the data to these variables which he
wants to persist.***o A stateful session bean retains its state across multiple
method invocations made by the same client. If the stateful session bean's state
is changed during a method invocation, then that state will be available to the
same client on the following invocation. The state of a client bean is retained for
the duration of the client-bean session. Once the client removes the bean or
terminates, the session ends and the state disappears.******o Because the
client interacts with its bean, this state is often called the conversational
state.****o For example, consider a customer using a debit card at an ATM
machine. The ATM could perform various operations like checking an account
balance, transferring funds, or making a withdrawal. These operations could be
performed one by one, by the same customer. So the bean needs to keep track
its state for each of these operations to the same client. Thus Stateful session
beans has the extra overhead for the server to maintain the state than the
stateless session bean.***
o Life Cycle of a Stateful Session Bean:***
o A Stateful session bean starts its life cycle when the client first gets the
referenceof a stateful session bean. Before invoking the method annotated
@PostConstruct the container performs any dependency injection after this the
bean is ready.*********o The container may deactivate a bean while in ready
state (Generally the container uses the least recently use algorithm to passivates
a bean). In the passivate mechanism the bean moves from memory to
secondary memory.*******o The container invokes the annotated
@PrePassivate method before passivating the bean******.o If a client invokes a
business method on the passivated bean then the container invokes the
annotated @PostActivate method to let come the bean in the ready******3)
Singleton Session Bean: One instance per application, it is shared between
clients and supports concurrent access.******o A Singleton Session Bean
maintains the state of the bean for the complete lifecycle of the
application.********o Singleton Session Beans are similar to Stateless Session
Beans but only one instance of the Singleton Session Bean is created in the
whole application and does not terminates until the application is shut
down.*******o The single instance of the bean is shared between multiple
clients and can be concurrently accessed.
9 Write a short note on Remote and Local Interfaces. (NOV 2022)
o Remote and Local Interfaces
o Remote
o A remote client or remote access of an enterprise bean has the following traits
(characteristics)- It can run on a different machine and a different Java Virtual
Machine (JVM) than the enterprise bean it accesses. (it is not required to run on
a different JVM) It can be a web component, an application client, or another
enterprise bean. To a remote client, the location of the enterprise bean is
transparent. To create an enterprise bean that allows remote access, you must
do one of the following:-
o Decorate the business interface of the enterprise bean with the @Remote
annotation:
o @Remote
o Public interface InterfaceName{…….}
o Decorate the bean class with @Remote, specifying the business interface or o
@Remote(InterfaceName.class)
o Public class BeanName implements InterfaceName{……..}
o The remote interface defines the business and lifecycle methods that are
specific to the bean. For example- the remote interface of a bean named
BankAccountBean might have business methods named deposit and credit.
o Local
o A local client or local access has following characteristics:- It must run in the
same JVM as the enterprise bean it accesses. It can be a web component or
another enterprise bean. To the local client, the location of the enterprise bean
it accesses is not transparent.
o The local business interface defines the bean’s business and lifecycle methods.
If the bean’s business interface is not decorated with @Local or @Remote , and
the bean class does not specify the interface using @Local or @Remote, the
business interface is by default a local interface. To build an enterprise bean that
allows only local access, you may, but are not required to do the following:-
o Annotate the business interface of the enterprise bean as a @Local interface.
For example:
o @Local o public Interface InterfaceName{……..}
o Specify the interface by decorating the bean class with @Local and specify the
interface name. for example:-
o @Local(InterfaceName.class)
o Public class BeanName implements InterfaceName{……..}
10 Explain the working behind message driven bean. (NOV 2018)
Write short note on Lifecycle of a Message Driven Bean with onMessage()
Method. (APR 2019)
Explain life cycle of a message driven bean using suitable diagram. (NOV 2019)
Describe message-driven beans characteristics. (NOV 2022)OR
Define Message Driven Bean with its lifecycle. (APR 2023)

o Message Driven Beans


o Message driven beans are the light weight components used for
communication. In message driven beans the messaging service is in
asynchronous mode because the user is not intended to get the instant result.
o Message driven beans are the special type of components that can receive the
JMS as well as other type of messages.
o Message driven bean can also be used to receive the messages other than
JMS.
o When a message is reached at the destination then the EJB container invokes
the message driven bean. A message driven bean is decoupled with the client
that sends the message. A client is not allowed to access the message driven
bean through a business interface. The client can interact with the message
driven bean only through the messaging system.
o To interact with the message driven bean use the message provider specific
API such as JMS.
o The Life Cycle of a Message-Driven Bean
o The EJB container usually creates a pool of message-driven bean instances. For
each instance, the EJB container instantiates the bean and performs these tasks:
● It calls the setMessageDrivenContext method to pass the context object to the
instance.
● It calls the instance's ejbCreate method.
o Like a stateless session bean, a message-driven bean is never passivated, and
it has only two states: nonexistent and ready to receive messages.
o When a bean instance is processing a JMS message, its onMessage method is
being invoked.
o At the end of the life cycle, the container calls the ejbRemove method. The
bean's instance is then ready for garbage collection.
o Java Message Services (JMS):
o JMS API is an enterprise tool developed by Sun Microsystems used to develop
the enterprise applications.
o JMS API supports to a framework that allows the development of portable and
message based applications.
o JMS communicates in synchronous or in asynchronous mode by using point-to-
point and the publish-subscribe models respectively.
o JMS has become vendor specific and many vendors such as IBM, Oracle,
Hewlett-Packard, BEA Systems and Macromedia are providing the JMS
implementation.
o When to Use Message-Driven Beans
o Session beans allow you to send JMS messages and to receive them
synchronously but not asynchronously.
o To avoid tying up server resources, do not to use blocking synchronous
receives in a server-side component; in general, JMS messages should not be
sent or received synchronously.
o To receive messages asynchronously, use a message-driven bean.
11 Explain the life cycle of an interceptor. (NOV 2018)
How to define Interceptor? What is the role of Aroundlnvoke Method? (APR 2OR
What is an interceptor? How an interceptor is defined and how aroundlnvoke
What are Interceptors? Why are they used? (APR 2023)
Adding An Interceptor To An Enterprise Bean EJB 3.0 provides specification to
intercept business methods calls using methods annotated with @AroundInvoke
annotation. An interceptor method is called by ejbContainer before business
method call it is intercepting.● Request And Interceptor
● Interceptor can validate request before processing
● Defining An Interceptor ● Interceptors can be defined in Java as an method
interceptor or a class interceptor. The preferred way to define in Java code is by
using meta-data annotations. They can be defined in the application descriptor
as well, but, in that case they are not portable across Java EE servers.
Some of the meta-data annotations found in the javax.interceptor package
are: @AroundInvoke, @AroundTimeout, @PostConstruct, and @PreDestroy.
● AroundInvoke Method
@AroundInvoke
public Object methodInterceptor(InvocationContext ctx) throws Exception {
System.out.println("*** Intercepting call to LibraryBean method: "
+ ctx.getMethod().getName());
return ctx.proceed(); }
● Defines an interceptor method that interposes on business methods. May be
applied to any non- final, non-static method with a single parameter of type
InvocationContext and return type Object of the target class (or superclass) or of
any interceptor class. ● An AroundInvoke method can invoke any component or
resource that the method it is intercepting can invoke. ● AroundInvoke method
invocations occur within the same transaction and security context as the
method on which they are interposing.● AroundInvoke methods may throw any
exceptions that are allowed by the throws clause of the method on which they
are interposing. They may catch and suppress exceptions and recover by calling
InvocationContext.proceed(). ● public interface InvocationContext
● Exposes context information about the intercepted invocation and operations
that enable interceptor methods to control the behavior of the invocation chain.
● Applying Interceptor
Intercepted Stateless EJB
@Interceptors ({BusinessInterceptor.class})
@Stateless public class LibraryBean implements LibraryBeanRemote {
//implement business method }
Declares an ordered list of interceptors for a target class, a method or
constructor of a target class. @Interceptors(ValidationInterceptor.class)
public class Order { ... } *****Interceptor Metadata Annotations

Types of interceptors
● Default − Default interceptor is invoked for every bean within
deployment.Default interceptor can be applied only via xml (ejb-jar.xml).
● Class − Class level interceptor is invoked for every method of the bean. Class
level interceptor can be applied both by annotation of via xml(ejb-jar.xml).
● Method− Method level interceptor is invoked for a particular method of the
bean. Method level interceptor can be applied both by annotation of via
xml(ejb-jar.xml).
life cycle of an interceptor
● Interceptor interface defines three methods – init(), destroy() and intercept().
● init and destroy are the life cycle methods of an interceptor.
● Interceptors are Singleton classes and Struts2 initialize a new thread to handle
each request. ● init() method is called when interceptor instance is created and
we can initialize any resources in this method. destroy() method is called when
application is shutting down and we can release any resources in this method.
Interceptor Usage Scenarios
● Request and response logging
● Retrying the requests with a configurable back off strategy
● Request denial based on certain request parameters
● Altering the request URL address
12 Explain the concept of naming service. Add suitable illustration to it.
What is a naming service? (NOV 2022)
● Naming services naming service maintains a set of bindings. Bindings relate
names to objects. All objects in a naming system are named in the same way
(that is, they subscribe to the same naming convention). Clients use the naming
service to locate objects by name.
There are a number of existing naming services
● COS (Common Object Services) Naming: The naming service for CORBA
applications; allows applications to store and access references to CORBA
objects.
● DNS (Domain Name System): The Internet's naming service; maps people-
friendly names (such as www.etcee.com) into computer-friendly IP (Internet
Protocol) addresses in dotted- quad notation (207.69.175.36). Interestingly, DNS
is a distributed naming service, meaning that the service and its underlying
database is spread across many hosts on the Internet.
● LDAP (Lightweight Directory Access Protocol): Developed by the University of
Michigan; as its name implies, it is a lightweight version of DAP (Directory
Access Protocol), which in turn is part of X.500, a standard for network directory
services. Currently, over 40 companies endorse LDAP.
● NIS (Network Information System) and NIS+: Network naming services
developed by Sun Microsystems. Both allow users to access files and
applications on any host with a single ID and password.
13 What is Java Naming and Directory Interface? Explain. (NOV 2019)
What is Java Naming and Directory Interface? Explain. (APR 2023)

What Is Java Naming And Directory Interface?


Java Naming and Directory Interface [JNDI] is a part of the Java platform. It is a
Java API for a directory service that allows Java software clients to discover and
look up data and objects via a name.
The API provides:
● A mechanism to bind an object to a name
● A directory lookup interface that allows general queries
● An event interface that allows clients to determine when directory entries
have been modified
● LDAP extensions to support the additional capabilities of an LDAP service

14 What is DataSource Resource Definition in Java EE? (APR 2019)


Write a note on DataSource Resource Definition in Java EE 7. (NOV 2022)
DataSource Resource Definition In Java EE
● Java EE applications use DataSource objects when they access relational
databases through the JDBC API.
● A DataSource has a set of properties that identify the data source that it
represents. These properties include information such as:
o The location of the database server***o The name of the database
o The network protocol to use to communicate with the server.
● A DataSource object also works with a JNDI naming service. After a
DataSource object is registered with a JNDI naming service, an application can
use the JNDI API to access that DataSource object, which can then be used to
connect to the datasource it represents.***● To declare a JNDI DataSource for
the MySQL database above, create a Resource XML element with the following
content:***o <Resource name="jdbc/UsersDB"
****auth="Container"type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
driverClassName="com.mysql.jdbc.Driver"****url="jdbc:mysql://localhost:3306
/usersDB" username="root"*password="secret"***/>***● To access
resource***o Context initContext = new InitialContext();
o Context envContext = (Context) initContext.lookup("java:comp/env");
o DataSource ds = (DataSource) envContext.lookup("jdbc/UsersDB");
o Connection conn = ds.getConnection()
14 Explain basic look up in JNDI. Also explain resource injection in JNDI.

● Basic Lookup

● JNDI organizes its names into a hierarchy.

● A name can be any string such as org.ejb.ConverterBean or can also be an


object that supports the Name interface. A string is the most common way to
name an object.

● A name is bound to an object in the directory by storing either the object or a


reference to the object in the directory service identified by the name.

● The user of the JNDI client API will first be required to create an initial context
to the naming or directory service to connect to.

● This initial context establishes a connection with the naming or directory


service when it is constructed with a set of properties that describes:
o The specific naming or directory service provider library to use
o The URL of the naming or directory service process
o A user name and credentials

● JNDI API defines a context that specifies where to look for an object. The
initial context is typically used as a starting point for all naming and directory
operations.

● An initial context must be created using the specific implementation and extra
parameters required by the implementation. The initial context will be used to
look up a name.

● After an initial context to a naming or directory service is established, the root


context or sub- context reference is used, which performs various operations on
the context depending on the type of context.
● Naming contexts can be used for binding and unbinding names and objects,
list names and name bindings and lookup object references of named objects.
InitialContext ic = new InitialContext(); cart=(ShoppingCartRemote)
ic.lookup(“java:global/ShoppingCart/ShoppingCart”);
● Using the lookup() method of the InitialContext object the named object of
the ShoppingCartRemote class is retrieved.

● The named object that is returned by the lookup() method is type casted to
ShoppingCartRemote and then assigned to the ShoppingCartRemote class object
created earlier named cart.

● Resource Injection
o The javax.annotation.Resource annotation is used to declare a reference to a
resource. @Resource can be used in a class, a field or a method.

o The container injects the resource referred to by @Resource into the


component either at runtime or when the component is initialized, depending
on whether field/method injection or class injection is used.

o With field and method-based injection, the container injects the resource
when the application is initialized. For class-based injection, the resource is
looked up by the application at runtime.

@Resource
private MessageDrivenContext mdc;
A Message-Driven Bean is injected by a MessageDrivenContext resource. This
resource is commonly used to call the setRollbackOnly() method to handle
exceptions for a bean that uses container-managed transactions.
Unit 51 What is Persistence? Explain. (NOV 2019)
or
Write a note on Java Persistent API. (APR 2023)
● What Is Persistence?
● Most business applications require that data must be persistent. Data can be
labeled as persistent only when it manages to survive day to day problems such
as system crashes and network failures.
● In enterprise application architecture, data persistence is implemented as:
o Having data stored outside an application's active memory, known as
persistent data store, typically a relational database or an object database or a
flat file system Having a rollback system, where, in case of system failure, the
state of the data is rolled back to its last known valid data state.
o Large amounts of data should not be stored in an HTTP session, instead a
database should be considered.
o The type of database that is chosen also plays an important influence on the
architecture and design.
● Persistence In Java
● Persistence in Java usually means storing data in a relational database using
SQL.
● In Java, persistence is accomplished by storing data in a Relational Database
Management
● System [RDBMS]. SQL is used to get data in and out of the relational database.
● Java DataBase Connectivity [JDBC] - The Java API is used to connect to the
RDBMS and fire SQL statements.
● Object Oriented Programming is based on OBJECTS that represent the
business model [the real world]. Objects are easily traversed through
relationship graphs using inheritance, associations.
● Object Persistence deals with persistence in object oriented programs such as
Java. It means determining how objects and their relationships are persisted in a
relational database.
● Object persistence is about
o Mapping object state
o Determining how an object's state [data stored in member variables of an
object] is stored in database table columns
o Dealing with the fact that object state types may not align with relational
database types
o Mapping object relationships
Telegram | youtube | Android App | website | instagram | whatsapp | e-next
For detailed Video Lecture Download The Shikshak Edu App
o Determining how associations between objects are stored as relational
database keys
or in relational database intersection tables
● Why Object Oriented Models?
● Business logic can be implemented in Java as opposed to stored procedures
● Design patterns and sophisticated object oriented concepts such as
inheritance and
● polymorphism can be used
● Provides code reusability and maintainability.
In most of the applications, storing and retrieving information usually involves
some kind of
interaction with a relational database
● Why Relational Database?
● A relational database is a choice because of the following:
o It is a proven data persistence technology
o Provides flexible and robust approach to data management
o It is the De-facto standard in software development
● The Java Persistence API
● The Java Persistence API is a standard API that allows accessing, persisting and
managing data
between Java objects / classes and the relational database in Java EE 5 platform.
● JPA provides standard mechanisms to using Object Relational Mapping tools.
● Java Persistence consists of three areas:
o The Java Persistence API
o Object/Relational mapping metadata
o The Query language
● Object-relational mapping with the Java Persistence API is entirely metadata
driven.
● It can be done by:
o Adding annotations to the code spec OR
o Using externally defined XML OR
o Using annotations as well as externally defined XML
2 Explain the persistent standards available in java. (NOV 2018)
What is Impedance Mismatch? How it can be solved? (NOV 2018)
What is The Impedance Mismatch? How it can be solved? (APR 2019)
Define Impedance Mismatch. What is a solution to the Impedance Mismatch?
● Why Another Persistence Standards
o The object oriented [domain] model use classes whereas the relational
databases use tables. This creates a gap [The Impedance Mismatch].
o Getting the data and associations from objects into relational table structure
and vice versa requires a lot of tedious programming due to the difference
between the two.
o This difference is called The Impedance Mismatch.
o Developers need something simple to convert from one to the other
automatically.
o Bridging the gap between the object model and the relational model is known
as Object- Relational Mapping [O-R mapping or ORM].
o The Impedance Mismatch
▪ Relational databases are structured in a tabular manner and the object
oriented instances are structured in a hierarchical manner.
o How To Map One To The Other?
▪ The most native approach that is usually taken is a simple mapping between
each class and the database table. This approach requires writing a lot of code
spec that maps one to the other. This code spec is often complex, tedious and
costly to develop.
o The Solution To The Impedance Mismatch
▪ This impedance mismatch has led to the development of several different
object persistence technologies attempting to bridge the gap between the
relational world and the object oriented world.
▪ Hence the solution is:
● Use an Object Relational Mapping Tool.
● An Object Relational Mapping Tool provides a simple API for storing
and retrieving Java objects directly to and from the relational database
● Object/Relational Mapping [ORM] is a technique that allows an
application written in an object oriented language to deal with the
information [it manipulates] as objects, rather than using database
specific concepts such as ROWS, COLUMNS and TABLES which is
facilitated by a software called Object/Relational Mapper.
● Object/Relational Mapper also offers persistence services [CRUD]
● O/R mapping is performed by a persistence framework.
● This framework knows how to:
o Query the database to retrieve objects
o Persist those objects back to their representation in the
database's tables and columns
▪ ORM has several benefits.
● Eliminates writing SQL to load and persist object state, leaving the developer
free to concentrate on the business logic
● Enables creating an appropriate DOMAIN model, after which, the developer
only needs to think in terms of OBJECTS, rather than TABLES, ROWS and
COLUMNS
● Reduces dependence on database specific SQL and thus provides Portability
across databases
● Reduces more than 30% of the amount of Java code spec that needs to be
written by adopting an ORM

3 Explain Java Persistence API with Specification. (APR 2019)


● JPA 2.0 specification ● ORM mapping enhancements
o Ability to map unidirectional one-to-many relationships as JPA 1.0
only allowed bidirectional one-to-many relationships
o Ability to model collections, maps and lists using
@ElementCollection annotation
● EntityManager and the Query APIs now support:
o Retrieving the first result
o Accessing the underlying vendor-specific entity manager/query
objects
o Pessimistic locking
● JPQL has been enhanced with SQL-like CASE, NULLIF, COALESCE and
like capabilities
● Criteria API similar to the one that Hibernate provides
Standardization of:
o Second level caching
o Hints for Query configuration and for EntityManager configuration o
Metadata to support DDL generation and Java2DB mapping
● Support for validation
4 Where Does Java Persistence API Fit In? (NOV 2022)
● Where does java persistence API fits in
o there are several good ORM tools available that perform the mapping
between objects --Relational Database Tables and thereby solved the impedance
Mismatch:
▪ Hibernate ▪ OpenJPA ▪ TopLink ▪ EdipseLink
o These Object-Relational Mapping tools/frameworks allow the developers to
focus on the object model instead of dealing with the mismatch between the
object-oriented and relational paradigms.
o Unfortunately, each of these tools has its own set of APIs. This ties the
application code spec to the proprietary interfaces of a specific vendor [ORM
tool].
o Since the code spec is tied to a specific vendor [referred to as Vendor Lock-In],
switching to another tool is not possible without rewriting all the persistence
code spec
● Where Does ORM/JPA Fit?
● An ORM tool can be invoked from a Java application either directly or by using
another framework such as Struts, Spring and so on.
● Java Persistence API makes it easy for these frameworks to support in one way
or another.
o An ORM tool along with the JPA can be used in: o A Swing application
o A Servlet o A JSP o An Enterprise application
● Any other kind of Java application that has access to a database
● Typically, an ORM tool is used to create a Data Access Layer for an application.
o The most typical workflow would be:
▪ Define the configuration details using a Persistence Unit
▪ Create an EntityManagerFactory object by referencing the Persistence Unit
▪ Instantiate the EntityManager object through which the application accesses
ORM tool's representation of the database
5 Explain JPA Architecture with the help of a neat diagram. (NOV 2018)
Explain with suitable diagram architecture of JavaPersistence API (NOV 2019)
Describe the architecture of Java Persistent API with suitable diagram.
● Architecture of JPA

● Persistence
o The javax.persistence.Persistence class contains static helper
methods to obtain EntityManagerFactory instances in a vendor-
neutral fashion.
● EntityManagerFactory
o The EntityManagerFactory is created with the help of a Persistence
Unit during the application start up. It serves as a factory for spawning
EntityManager objects when required.
o Typically, it is created once [one EntityManagerFactory object per
database] and kept alive for later use.

● EntityManager
o The EntityManager object [javax.persistence.EntityManager] is
lightweight and inexpensive to create. It provides the main interface
to perform actual database operations.
o All the POJOs i.e. persistent objects are saved and retrieved with the
help of an EntityManager object.
o Typically, EntityManager objects are created as needed and
destroyed when not required.
o Each EntityManager manages a set of persistent objects and has
APIs to insert new objects and delete existing ones.

● Entity
o Entites are persistent objects that represent datastore records.
● EntityTransaction
o A Transaction represents a unit of work with the database.
o Any kind of modifications initiated via the EntityManager object are
placed within a transaction. An EntityManager object helps creating
an EntityTransaction object.
o Transaction objects are typically used for a short time and are closed
by either
committing or rejecting.

● Query
o Persistent objects are retrieved using a Query object.
o Query objects [javax.persistence.Query] allows using SQL or Java
Persistence QueryLanguage [JPQL] queries to retrieve the actual data
from the database and create objects.
● Criteria
o Criteria API is a non-string-based API for the dynamic construction of
object-based queries [javax.persistence.criteria].
o Just like JPQL static and dynamic queries, criteria query objects are
passed to the EntityManager's createQuery() method to create Query
objects and then executed using the methods of the Query API.
o WHERE clause predicates
o SELECT clauses, which comprise one or more select item objects
o ORDER-BY and GROUP-BY items
o Subqueries
6 What is the relationship between JPA, ORM, Database and the application?
(APR 2019)

JPA, ORM, Database And The Application

● JPA is made up of a few classes and interfaces.


● The application communicates with the configured JPA provider [in this case
EclipseLink] to access the underlying data.
● Typically, applications invoke the appropriate methods of the Java Persistence
API, These methods are passed the persistence objects and instructed to
operate upon them.
● The information about the mapping [metadata] between the instance
variables of classes and the columns of the tables in the database is available
either in XML and/or POJOs with the help of Annotations.
● POJOs are Java classes that represent the tables in the database. Data Access
Object [DAO] is the design pattern that can be used [if required] to deal with
database operations.
7 Write short note on Functions in JPQL and Downcasting in JPQL.
Write a short note on Functions in JPQL and Downcasting in JPQL.
Java Persistence Query language

● JPQL is Java Persistence Query Language defined in JPA specification.


It is used to create queries against entities to store in a relational
database. JPQL is developed based on SQL syntax. But it won’t affect
the database directly.
● JPQL can retrieve information or data using SELECT clause, can do
bulk updates using UPDATE clause and DELETE clause.
EntityManager.createQuery() API will support for querying language.
o Query Casting
▪ Use query casting to query across attributes in subclasses when using
JPA or ORM. This feature is available in JPQL, EclipseLink Expressions,
and Criteria API.
▪ The following examples show how to use EclipseLink to define
queries on inheritance hierarchies with down casting to specific
classes.
o JPA 2.0 Type
▪ Starting with JPA 2.0, it is possible to limit the results or a query to
those of a specific subclass. For example, the expression framework
provides Expression.type(Class).
▪ For example, the following query retrieves all the LargeProjects
(subclass of Project) from Employee:
▪ select p from Employee e join e.projects p where type(p) =
LargeProject
o Downcasting in JPQL
▪ In JPQL, downcasting is accomplished in the FROM clause, using
TREAT...AS in the JOIN clause. For example:
▪ select e from Employee e join TREAT(e.projects AS LargeProject) lp
where lp.budget = value
8 Explain following: (NOV 2022)
i) JOIN condition Using ON ii) Entity Listeners Using CDI

● Java Persistence Query language


● JPQL is Java Persistence Query Language defined in JPA specification. It is used
to create queries against entities to store in a relational database. JPQL is
developed based on SQL syntax. But it won’t affect the database directly.
● JPQL can retrieve information or data using SELECT clause, can do bulk
updates using UPDATE clause and DELETE clause. EntityManager.createQuery()
API will support for querying language.
o Query Casting
▪ Use query casting to query across attributes in subclasses when using JPA or
ORM. This feature is available in JPQL, EclipseLink Expressions, and Criteria API.
▪ The following examples show how to use EclipseLink to define queries on
inheritance hierarchies with down casting to specific classes.
o JPA 2.0 Type
▪ Starting with JPA 2.0, it is possible to limit the results or a query to those of a
specific subclass. For example, the expression framework provides
Expression.type(Class).
▪ For example, the following query retrieves all the LargeProjects (subclass of
Project) from Employee:
▪ select p from Employee e join e.projects p where type(p) = LargeProject
o Downcasting in JPQL
▪ In JPQL, downcasting is accomplished in the FROM clause, using TREAT...AS in
the JOIN clause. For example:
▪ select e from Employee e join TREAT(e.projects AS LargeProject) lp where
lp.budget = value
● join condition using ON
o The ON clause in SQL is used to specify the relationship between the tables. it
is different from the WHERE clause, whicj specifies the criteria for the records to
be picked
o join condition used for a join comes from the mapping's join columns which
means that the PQL user is normally free from having to know how every
relationship is joined.
o In some cases it is desirable to append additional conditions to join condition,
normally in the case of outer joins, This can be done through the ON clause.
o Solution
SELECT s.Name, COUNT(p)
FROM Supplers s LEFT JOIN s.Products p
ON p.Status = 'InStock'
GROUP BY s.Name
o mapped SQL would be:
SELECT s.Name, COUNT(p.ProductNo)
Suppliers s LEFT JOIN Products p
ON s.SuppierNo = p.SupplierNo AND p.Status = InStock
GROUP BY s.Name
o explanation:
▪ s.SupplierNo = p.SupplierNo condition is generated because of the LEFT JOIN.
▪ additional JOIN condition p.Status = 'InStock' is also added to the generated
SQL because of the ON clause in the JPQL.
▪ the result Of this query will include all suppliers with possibly NULL values.
this is defferent from the query below:
SELECT s.Name, COUNT(p)
FROM Suppliers s LEFT JOIN s.Products p
WHERE p.Status = 'InStock'
GROUP BY s.Name
● Entity Listeners Using CDI
o Entity Listeners allows handling cross-cutting lifecycle events in a non
persistence listener class
o In JPA 2.1, entity listeners support dependency injection through CDI.
o The usual lifecycle callback methods of @PrePersist, @PostPersist,
@PreUpdate @PreRemove can be used for entities.
o The entity listeners can also be annotated with @PostConstruct and
@PreDestroy for their, own lifecycle. Customers.java @Entity
@EntityListeners(LastLogin.class)
public class Customers {
@Id***private Integer customerNo; private String firstName;
}***Listener : LastLogin.java ***pubic class LastLogin {
@PostPersist***pubic void lastLogin(Customers customer) {
}
}
9 Enlist the benefits of Object Relational Mapping. (APR 2023)
Why is there a need for Object Relational Mapping (ORM) (NOV 2022)
● An ORM provides the following advantages:
● Better System Architecture
o If the application functionality [business logic] and the database access code
spec
[persistence mechanism] are separated, applying changes become very easy.
● Reduce Coding Time
o Most of the time the database access code spec is simple inserts, updates or
deletes. These are SQL statements which sometimes are quite tedious to code.
o ORM tool helps here, by generating them on the fly and thereby saves a lot of
time.
● Caching And Transactions
o Most ORM tools such as Hibernate come with features such as Caching and
Transactions.
10 What is Hibernate? Explain Object Relational Mapping. (NOV 2019)
How hibernate works? (APR 2019)
What is Hibernate? Explain the features of Hibernate. (NOV 2022)
● What Is Hibernate? ● Hibernate is the latest Open Source persistence
technology ● free open source [distributed under the GNU Lesser General Public
License] Object/Relational Mapping [ORM] library for the Java programming
language ● It provides a framework for mapping an object oriented DOMAIN
model to a traditional Relational Database. ● Its primary feature is mapping
from: o Java Classes -> Database Tables o Java Data Types -> SQL Data Types
● Hibernate also allows querying and retrieving data. It generates all the
necessary SQL calls to achieve this and thereby, relieves the developers from
manual result set handling and object conversion.● Why Hibernate? ● It
eliminates the need for repetitive SQL ● It allows working with classes and
objects instead of queries and result sets which makes the approach more
Object Oriented and less Procedural ● Handles all Create, Read, Update, Delete
[CRUD] operations ● Brings in portability across databases ● Reduces the
development time by supporting inheritance, polymorphism, composition and
the Java Collection framework ● Hibernate's Dual Layer Cache Architecture
[HDCLCA] delivers thread safeness, non- blocking data access, session level
cache, optional second-level cache and optional query cache.
● Supports connection pooling
● Supports wide range of database
11 Draw and explain the architecture of hibernate framework. (NOV 2018)
Explain the architecture of Hibernate with suitable. Diagram. (NOV 2019)
Elaborate the architecture of Hibernate with suitable diagram. (APR 2023)
● Architecture of hibernate o Hibernate makes use of persistent
objects commonly called as POJO (POJO = "Plain Old Java Object".)
along with XML mapping documents for persisting objects to the
database layer. The term POJO refers to a normal Java objects that
does not serve any other special role or implement any special
interfaces of any of the Java frameworks (EJB, JDBC, DAO, JDO, etc...).
o SessionFactory (org.hibernate.SessionFactory) o A threadsafe
(immutable) cache of compiled mappings for a single database. A
factory for Session and a client of ConnectionProvider. Might hold an
optional(second-level) cache of data that is reusable between
transactions, at a process- or cluster-level.
o Session (org.hibernate.Session) o A single-threaded, short-lived
object representing a conversation between the application and the
persistent store. Wraps a JDBC connection. Factory for
Transaction. Holds a mandatory (first-level) cache of persistent
objects, used when navigating the object graph or looking up objects
by identifier.
o Persistent objects and collections o Short-lived, single threaded
objects containing persistent state and business function. These might
be ordinary JavaBeans/POJOs, the only special thing about them is
that they are currently associated with (exactly one) Session. As soon
as the Session is closed, they will be detached and free to use in any
application layer (e.g.
directly as data transfer objects to and from presentation).
o Transient and detached objects and collections
o Instances of persistent classes that are not currently associated with
a Session. They may have been instantiated by the application and not
(yet) persisted or they may have been instantiated by a closed Session.
o Transaction (org.hibernate.Transaction)
o (Optional) A single-threaded, short-lived object used by the
application to specify atomic units of work. Abstracts application from
underlying JDBC, JTA or CORBA transaction. A Session might span
several Transactions in some cases. However, transaction
demarcation, either using the underlying API or Transaction, is never
optional!
o ConnectionProvider (org.hibernate.connection.ConnectionProvider)
o (Optional) A factory for (and pool of) JDBC connections. Abstracts
application from underlying Datasource or DriverManager. Not
exposed to application, but can be extended/implemented by the
developer.
o TransactionFactory (org.hibernate.TransactionFactory)
o (Optional) A factory for Transaction instances. Not exposed to the
application, but can be extended/implemented by the developer.
12 Explain different components of hibernate. (NOV 2018)
What are the different components of Hibernate? (APR 2023)
● Components Of Hibernate ● Connection Management
o Hibernate's Connection management service provides efficient management
of the database connections. ● Transaction Management
o Transaction management service provides the ability to execute more than
one. database statements at a time. ● Object Relational Mapping
o Object relational mapping is a technique of mapping the data representation
from an object model to a relational data model. This part of Hibernate is used
to SELECT, INSERT, UPDATE and DELETE records from the underlying database
tables. o Usually a populated object of a POJO is passed to Session.save()
method. Hibernate reads the state of the variables of that object and executes
the necessary SQL query.
13 Explain the modus operandi behind hibernate application. (NOV 2018)
● How Hibernate Works?
An XML mapping document is created, which informs Hibernate about:
● The classes needed to store the data ● How the classes are related to the
tables and columns in the database ● The mapping document is compiled, when
the application starts up. It provides the Hibernate framework with all the
necessary information. ● During the runtime, Hibernate reads the XML mapping
document and dynamically builds Java classes to manage the translation
between the database and the Java objects. ● A SessionFactory is created from
the compiled collection of mapping documents. The SessionFactory provides the
mechanism for managing persistent classes and the Sessioninterface.
● A SessionFactory is created from the compiled collection of mapping
documents. The SessionFactory provides the mechanism for managing
persistent classes and the Session interface. ● The Session class provides the
interface between the persistent data store and the application. The Session
interface wraps a JDBC connection, which can be user managed or controlled by
Hibernate and is only intended to be used by a single application thread, then
closed and discarded. ● All the database interaction is done via a simple,
intuitive API that Hibernate provides. This API allows performing queries against
the objects represented by the database. This API informs Hibernate:
o To save the changes whenever the objects are changed
o To store the objects in the database whenever new objects are created
14 Explain the structure of hibernate.cfg.xml. (APR 2019)
<hibernate-configuration>
<session-factory>
<property
name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</
property>
<property
name="hibernate.connection.url">jdbc:mysql://localhost:3306/java2
novice</property>
<property
name="hibernate.connection.username">root</property>
<property
name="hibernate.connection.password">root</property>
<property
name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</pro
perty>
<property name="show_sql">false</property>
</session-factory>
</hibernate-configuration>
o hibernate.dialect : This property makes Hibernate generate the
appropriate SQL for the chosen database.
o hibernate.connection.driver_class : The JDBC driver class.
o hibernate.connection.url : The JDBC URL to the database instance.
o hibernate.connection.username : The database username.
o hibernate.connection.password : The database password.
o hibernate.connection.pool_size : Limits the number of connections
waiting in the Hibernate database connection pool.
o hibernate.connection.autocommit : Allows autocommit mode to be
used for the JDBC connection.

You might also like