Hibernate 2
Hibernate 2
HIBERNATE
STRUTS
By Raghu
By : : AbhiRam
Sathya Technologies…
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 1
Sathya Technologies
ECLIPSE
Overview
Eclipse is an Integrated Development Environment (IDE) for Java and other programming
languages like C, C++, PHP, and Ruby etc.
Today it is the leading development environment for Java with a market share of approximately
65%.
The Eclipse IDE can be extended with additional software components. Eclipse calls these
software components as plug-ins.
Several Open Source projects and companies have extended the Eclipse IDE or created
standalone applications on top of the Eclipse framework.
Eclipse Licensing
Eclipse platform and other plug-ins from the Eclipse foundation is released under the Eclipse
Public License (EPL). EPL ensures that Eclipse is free to download and install. It also allows
Eclipse to be modified and distributed.
Downloading Eclipse
You can download eclipse from http://www.eclipse.org/downloads/. The download page lists a
number of flavours of eclipse.
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 2
Sathya Technologies
Eclipse is written in Java and will thus need an installed JRE or JDK in which to execute.
Launching Eclipse
On the windows platform, if you extracted the contents of the zip file to c:\, then you can start
eclipse by using c:\eclipse\eclipse.exe
When eclipse starts up for the first time it prompts you for the location of the workspace folder.
All your data will be stored in the workspace folder. You can accept the default or choose a new
location.
The first time you launch Eclipse, you will be presented with a welcome screen. From here you
can access an overview to the platform, tutorials, sample code, etc…
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 3
Sathya Technologies
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 4
Sathya Technologies
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 5
Sathya Technologies
The newly created project should then appear under the Package Explorer.
Eclipse automatically creates a folder to store your source code in called “src”.
Creating a Class
To create a class, simply click on the New button, then select Class.
This brings up the new class wizard, from here you can specify the Package, Class name,
Super class, whether or not to include a main() method etc.
Fill in necessary information then click Finish to continue.
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 6
Sathya Technologies
One big advantage/feature of Eclipse is that it automatically compiles your code in the
background.
No longer need to go to the command prompt and compile code directly.
Iterative development is the best approach to developing code, but going to command
prompt to do a compile can interrupt the normal course of development.
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 7
Sathya Technologies
Running Code
An easy way to run code is to right click on the class and select Run As Java
Application.
The output of running the code can be seen in the Console tab in the bottom pane.
Advanced options for executing a program can be found by right clicking the class then
clicking Run As Run Configurations
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 8
Sathya Technologies
Here you can change/add any of JVM arguments, Command line arguments, Class path
settings, Environment, variables etc.
Debugging Code
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 9
Sathya Technologies
An easy way to enter debug mode is to right click on the class and select Debug As
Java Application.
The first time you try to debug code you will be presented with the following dialog.
Eclipse is asking if you want to switch to a perspective that is more suited for debugging,
click Yes.
Eclipse has many perspectives based on what you are doing (by default we get the Java
perspective).
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 10
Sathya Technologies
Debug Perspective
Import Organization
Eclipse can automatically include import statements for any classes you are using, just
press Control + Shift + o (letter o).
If the class is ambiguous (more than one in the API) then it will ask you to select the
correct one.
Import statements automatically included and organized, you can organize imports to
clean them up at any time.
Context Assist
If you are typing and press a “.” character and pause a second, eclipse will show you a
list of all available methods for the class.
Get context assist at any time by pressing Control + Space.
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 11
Sathya Technologies
Javadoc Assist
Eclipse can also help generate javadoc comments for you, simply place the cursor before
the method and then type “/**” then Enter.
Eclipse will automatically generate a javadoc header for the method all stubbed out with
the parameters, return type and exceptions.
Getter/Setter Generation
Eclipse can automatically generate getters and setters for member of a class.
To generate getters and setters, right click in the main pane, and then select Source
Generate Getters and Setters.
Eclipse can also stub out methods that need to be present as a result of implementing
an interface.
You can use the quick fix light bulb to add the interfaces unimplemented methods to the
class.
Exception Handling
Local History
The eclipse maintains a local history of file revisions which can be accessed by right
clicking on the class, then selecting Compare With Local History.
Previous saved revisions are displayed in the History pane, double click a revision to
view in the built-in diff viewer.
The Jar File wizard can be used to export the content of a project into a jar file.
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 12
Sathya Technologies
In the Package Explorer select the items that you want to export. If you want to export
all the classes and resources in the project just select the project.
Click on the File menu and select Export.
In the filter text box of the first page of the export wizard type in "JAR".
Under the Java category select JAR file
Click on Next
A project can have zero or more builders associated with it. A java project is associated with a
java builder. To see the builders associated with a project:
In the Package Explorer view right click on the project and select Properties
On the tree in the left hand side click Builders
The java builder is responsible for compiling the java source code and generating classes. The
java builder is notified of changes to the resources in a workspace and can automatically
compile java code.
The Eclipse platform which provides the foundation for the Eclipse IDE is composed of plug-ins
and is designed to be extensible using additional plug-ins.
Several hundreds of plug-ins are available. Each plug-in adds more functionality to Eclipse. You
can locate a plug-in that provides certain functionality by searching the Eclipse Market place
(http://marketplace.eclipse.org/).
From within the Eclipse IDE you can search the market place by using the Eclipse
Marketplace dialog which can be invoked by clicking on the Help menu and selecting
Eclipse Marketplace.
You can also install a plug-in by using the Install New Software menu item accessible
from the Help menu (Help > Install New Software).
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 13
Sathya Technologies
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 14
Sathya Technologies
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 15
Sathya Technologies
5. Select the Target Runtime from the list if does not exist then add new target runtime by
clicking New Runtime button. Here from the list of the list of Runtime select your
server's runtime e.g. I selected Apache Tomcat v6.0.
6. Click next to specify the server configuration, where you can specify the name, location
and JRE for the server runtime and click on Finish button
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 16
Sathya Technologies
7. Now you will come back to first page of the Dynamic Web Project wizard. Here select
Dynamic Web module version to 2.5 or higher and leave all the other parameters as
default values though you can change them as per your need.
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 17
Sathya Technologies
8. Click on the Next button to configure source location and Default output folder similar
to Java Project.
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 18
Sathya Technologies
11. Now hit the finish button and Dynamic Web Project gets created with following
structure.
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 19
Sathya Technologies
JavaSource
Contains the project's Java source code for classes, beans, and servlets. When these resources
are added to a Web project, they are automatically compiled and the generated files are added
to the WEB-INF/classes directory. The contents of the source directory are not packaged in
WAR files unless an option is specified when a WAR file is created.
WebContent folder
The mandatory location of all Web resources, including HTML, JSP, graphic files, and so on.
META-INF
This directory contains the MANIFEST.MF file, which is used to map class paths for dependent
JAR files that exist in other projects in the same Enterprise Application project..
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 20
Sathya Technologies
WEB-INF
Based on the Sun Microsystems (now Oracle) Java Servlet 2.3 Specification, this directory
contains the supporting Web resources for a Web application, including the web.xml file and
the classes and lib directories.
/classes
This directory is for servlets, utility classes, and the Java compiler output directory. The classes
in this directory are used by the application class loader to load the classes. Folders in this
directory will map package and class names, as in: /WEB-INF/ classes/ com/ pack/ servlets/
MyServlet.class.
/lib
The supporting JAR files that your Web application references. Any classes in .jar files placed in
this directory will be available for your Web application.
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 21
Sathya Technologies
INTRODUCTION
A Java program always produces results after execution (after running) of a “.class ”file. But this
result is sorted in a temporary location called RAM(Random Access Memory). Here RAM is temporary
memory location.
To store Data permanently, to access some other time, In Java Sun Micro System introduced an
API called java.io in JDK 1.0(January 23, 1996). This is used to communicate with any file system and
independent of OS.
So, to overcome the problems of File System DBMS and RDBMS Concepts are introduced.
Advantages of DBMS:
Controlling Data Redundancy
Sharing of Data over the network
Integration of one database with other.
Data Security
Backup and Recovery Procedures
And so on…
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 22
Sathya Technologies
Evaluation of JDBC:
In java (JDK 1.1 February 19, 1997) Sun Micro System introduced a Concept Java Database
Connectivity (JDBC) that supports Java program to interact with database.
Advantages of JDBC:
Limitations of JDBC:
Programmer also required of learning SQL/PL-SQL concepts. (Some time writing of SQL/PL-SQL
program is database dependent).
All the Exceptions are checked exceptions. So developer must handle these exceptions while
writing JDBC program (EX: SQLException).
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 23
Sathya Technologies
JDBC follows traditional RDBMS concept. It does not support OOP based database operations.
Creating and closing connections must be taken care of JDBC Developer.
Evaluation of ORM:
Object-relational mapping (ORM, O/RM, and O/R mapping) is a Object Oriented concept. It is
used to convert RDBMS Data to Object Oriented Data. So that Java programmer can easily work with
database to perform persistency operations.
This concept supports of complete OOPs concepts of wiring Persistency programs (ex: encapsulation,
inheritance etc..).
Implementations of ORM:
Hibernate
Ibatis
OJB
Torque
Castor
Java Ultra-Lite Persistence
Speedo
Advantages of ORM:
A high-level API for creating, reading, updating, and deleting the persistence objects.
An object-oriented query language for querying the persistence objects.
A caching mechanism with proper locking modes.
Supports Relationships like one-to-one, one-to-many or many-to-one, many-to-many.
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 24
Sathya Technologies
HIBERNATE
Hibernate was started in 2001 by Gavin King with colleagues from Cirrus Technologies as an
alternative to using EJB2-style entity beans. Its original goal was to offer better persistence capabilities
than offered by EJB2 by simplifying the complexities and supplementing missing features.
In early 2003, the Hibernate development team began Hibernate2 releases, which offered many
significant improvements over the first release.
JBoss, Inc. (now part of Red Hat) later hired the lead Hibernate developers in order to further its
development.
Blog: http://relation.to/Bloggers/Gavin
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 25
Sathya Technologies
7. Hibernate supports caching mechanism by this, the number of round trips between an
application and the database will be reduced, by using this caching technique an application
performance will be increased automatically.
8. Hibernate supports annotations based programming.
9. Hibernate provided Dialect classes which create Queries Dynamically.
10. Hibernate has its own query language, i.e hibernate query language which is database
independent.
11. Hibernate supports collections like List, Set, Map (Only new collections).
12. Hibernate supports Connection pooling.
13. Hibernate Supports below databases.
DB2 Informix
MySQL Ingres
Sybase Mckoi SQL
SAP DB Pointbase
HypersonicSQL Firebird
Progress PostgreSQL
Interbase Oracle
FrontBase Microsoft SQL Server
Hibernate Architecture:
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 26
Sathya Technologies
POJOs:
Plain Old Java Object (POJO) is a common java class that follows some rules like
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 27
Sathya Technologies
Factory Pattern:
Factory design pattern in Java one of the core design pattern which is used heavily not only in JDK
but also in various Open Source framework such as Spring, Struts and Apache along with decorator
design pattern in Java.
Factory method is used to create different object from factory often refereed as Item and it
encapsulate the creation code. So instead of having object creation code on client side we
encapsulate inside Factory method in Java.
One of the best examples of factory pattern in Java is BorderFactory Class of Swing API
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 28
Sathya Technologies
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 29
Sathya Technologies
DTD: Document Type Definition is used to specify tags, their attribute details to write an XML file.
Example DTD:
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 30
Sathya Technologies
1. Configuration (org.hibernate.cfg)
2. SessionFactory(org.hibernate)
3. Session (org.hibernate)
4. Query (org.hibernate)
5. Criteria (org.hibernate)
Configuration
The org.hibernate.cfg.Configuration class is the basic element of the Hibernate API that
allows us to build SessionFactory.
That means we can refer to Configuration as a factory class that produces SessionFactory.
The Configuration object encapsulates the Hibernate configuration details such as
connection properties, dialect and mapping details described in the Hibernate mapping
documents which are used to build the SessionFactory.
The Configuration object takes the responsibility to read the Hibernate configuration and
mapping XML documents, resolves them and loads the details into built-in Hibernate
objects.
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 31
Sathya Technologies
SessionFactory
Session
Query
Criteria
The org.hibernate.Criteria is the central interface for using Criterion API and it provides
a simplified API for using a programmatic approach of searching the persistent objects,
alternative to the HQL and SQL.
Hibernate Configuration
Hibernate allows us to add configuration parameters and mapping files location to the
configuration object.
Hibernate Mappings
The ORM implementations basically perform various services like creating, reading,
updating, and deleting the persistence objects.
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 32
Sathya Technologies
To perform this, ORM frameworks requires metadata information for the persistent
types (i.e., metadata for each persistent class).
This metadata is described by using the mapping XML documents or annotations.
The configure() method locates the hibernate.cfg.xml file in order to load the configuration
parameters and the mapping files location.
We can also use a XML configuration file with a different file name as shown in the code
snippet below:
cfg.configure(“myconfigs/adminmodule.cfg.xml”);
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 33
Sathya Technologies
After successfully preparing the Configuration object by setting all the configuration
parameters and mapping documents location, the configuration object is used to create the
SessionFactory.
To do this we use the buildSessionFactory() method of configuration, which creates a new
SessionFactory using the configuration parameters and mappings in this configuration.
cfg.configure();
SessionFactory factory=cfg.buildSessionFactory();
3. Obtain a Session
cfg.confogure();
SessionFactory factory=cfg.buildSessionFactory();
Session session=factory.openSession();
The openSession() method is used to open a new Session. However, in some cases,
especially in the managed environments, where multiple components are involved in
processing the request in a transaction, we want to work with a single Session to execute
the persistent operations.
The getCurrentSession() method can be used in such an environments. The
getCurrentSession() method obtains the Session associated with the current JTA
transaction; if a Session is not already associated with the current JTA transaction, a new
Session will be opened and it will be associated with the JTA transaction.
If Hibernate has no access to the TransactionManager or if the application is not associated
with any transaction, the getCurrentSession() method throws an HibernateException.
The following code snippet shows the code for location the associated with the current
transaction.
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 34
Sathya Technologies
cfg.configure();
SessionFactory factory=cfg.buildSessionFactory();
Session session=factory.getCurrentSession();
The Session interface provides an abstraction for Java application to perform the basic
CRUD (Create Read Update Delete) operations on the instances of mapped persistence
classes.
Method Description
Object load(Class Locates the persistent instance of the given entity class
entityClass, Serializable id) with the given identifier, if the persistent instance is not
available in the cache then it loads the instance from the
database and returns it to caller.
Object load(String Locates the persistent instance of the given entity class
entityName, Serializable with the given name and identifier, if the persistent
id) instance is not available in the cache then it loads the
instance from the database and returns it to caller.
void load(Class Reads the persistent state located with the given identifier
entityClass, Serializable id) into the given transient instance.
void update(Object obj) Update the persistence instance with the identifier of the
given object.
void saveOrUpdate(Object Either save or update the given instance, depending upon
obj) resolution of the unsaved-value checks.
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 35
Sathya Technologies
The methods of Session interface described allows the Java application to use Hibernate for
performing basic CRUD operations but most of the time we have a requirement to query for
persistent objects.
After we complete the use of Session, it has to be closed to release all the resources such as
cached entity objects, collections, proxies, and a JDBC connection.
That means the Hibernate Session encapsulates two important types of state, one is the
cache of the entity objects, and second a JDBC connection.
To close a Hibernate Session we can use close() method.
Session session=factory.openSession();
session.close();
Hibernate Libraries:
Hibernate can be downloaded from:
http://www.hibernate.org/downloads
From the download page that appears, choose to download the current latest release of
Hibernate Core. I have used Hibernate 3.3.1.GA in all the examples in this tutorial.
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 36
Sathya Technologies
These files are available in the directory of the Hibernate Core and Hibernate Annotations
download.
Project 1: SaveDataToDB
1. Student.java:
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 37
Sathya Technologies
2. Student.hbm.xml:
3. hibernate.cfg.xml:
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 38
Sathya Technologies
MainProgram.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 39
Sathya Technologies
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 40
Sathya Technologies
Project 2 : UpdateDBApp
Student.java
Student.hbm.xml
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 41
Sathya Technologies
Hibernate.cfg.xml:
MainProgram.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 42
Sathya Technologies
Folder Structure:
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 43
Sathya Technologies
Project 3 :SaveorUpdate
Student.java
Student.hdb.xml
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 44
Sathya Technologies
hibernate.hbm.xml
MainProgram.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 45
Sathya Technologies
Folder Structure:
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 46
Sathya Technologies
Project 4: GetDatApp
Student.java
Student.hbm.xml
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 47
Sathya Technologies
hibernate.hbm.xml
MainProgram.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 48
Sathya Technologies
Folder Structure:
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 49
Sathya Technologies
It will always return a “proxy” (Hibernate term) without hitting the database. In Hibernate, proxy
is an object with the given identifier value, its properties are not initialized yet, it just look like a
temporary fake object. If no row found , it will throws an ObjectNotFoundException.
2. session.get()
It always hit the database and return the real object, an object that represent the database row,
not proxy. If no row found , it return null.
SQL Dialects
Always set the hibernate.dialect property to the correct org.hibernate.dialect.Dialect subclass for your
database. If you specify a dialect, Hibernate will use sensible defaults for some of the other properties
listed above. This means that you will not have to specify them manually.
RDBMS Dialect
DB2 org.hibernate.dialect.DB2Dialect
DB2 AS/400 org.hibernate.dialect.DB2400Dialect
DB2 OS390 org.hibernate.dialect.DB2390Dialect
PostgreSQL org.hibernate.dialect.PostgreSQLDialect
MySQL org.hibernate.dialect.MySQLDialect
MySQL with InnoDB org.hibernate.dialect.MySQLInnoDBDialect
MySQL with MyISAM org.hibernate.dialect.MySQLMyISAMDialect
Oracle (any version) org.hibernate.dialect.OracleDialect
Oracle 9i org.hibernate.dialect.Oracle9iDialect
Oracle 10g org.hibernate.dialect.Oracle10gDialect
Sybase org.hibernate.dialect.SybaseDialect
Sybase Anywhere org.hibernate.dialect.SybaseAnywhereDialect
Microsoft SQL Server org.hibernate.dialect.SQLServerDialect
SAP DB org.hibernate.dialect.SAPDBDialect
Informix org.hibernate.dialect.InformixDialect
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 50
Sathya Technologies
RDBMS Dialect
HypersonicSQL org.hibernate.dialect.HSQLDialect
Ingres org.hibernate.dialect.IngresDialect
Progress org.hibernate.dialect.ProgressDialect
Mckoi SQL org.hibernate.dialect.MckoiDialect
Interbase org.hibernate.dialect.InterbaseDialect
Pointbase org.hibernate.dialect.PointbaseDialect
FrontBase org.hibernate.dialect.FrontbaseDialect
Firebird org.hibernate.dialect.FirebirdDialect
Hibernate works with normal Java objects (POJO) that the application creates using the new
operator. These objects are mapped to actual database tables using Hibernate Mapping
mechanism.
An instance of an object that is mapped to Hibernate can be in any one of three different
states i.e., Transient, Persistent or Detached.
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 51
Sathya Technologies
Transient Object
Transient Objects are those that are instantiated by the application but not yet made
persistent by calling the save() method of the session object.
This kind of object is instantiated using the new operator but is not immediately persistent.
Hence such an object is not associated with any database table row.
To convert a transient object to persistent state, the save() method of the session object is
invoked.
Persistent Object
Persistent Objects are those that are instantiated by the application and then made
persistent by calling the save() method of the session object.
Persistent objects are always associated with a session and are transactional.
Persistent objects participate in transactions and their state is synchronized with the
database at the end of the transaction. This means when a transaction is committed, the
state held in memory is propagated to the database by the execution of the appropriate
SQL.
Detached Object
After a transaction completes, all the associated persistent objects still exists in memory but
they lose their association with the session on encountering a session.close().
Such objects are called Detached Objects. A detached object indicates that its state will no
longer be synchronized with database state.
These objects can be reused in a new transaction by re-associating them with a new session
object.
A detached object can be re-associated with a new Hibernate session by invoking one of
these methods such as load(), refresh(), merge(), update() or save() on the new session with
a reference to the detached object.
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 52
Sathya Technologies
<generator> Element:
When inserting a new record/row in a database table for the instantiated java object, the ID
column must be populated with a unique value in order to uniquely identify that persisted
object.
The <generator> element helps define how to generate a new primary key for a new
instance of the class.
The <generator> element accepts a java class name that will be used to generate unique
identifiers for instances of the persistent class.
The <generator> element is the child element of <id> element.
Syntax:
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 53
Sathya Technologies
The increment class generates the primary key value by adding 1 to the current highest
primary key value.
Technically, this is achieved as follows:
The generator fires an SQL select query and retrieves the highest value of the primary key
column.
The generator then increments the primary key column value by 1.
This class generates identifiers of type long, short or int.
The identity class supports the identity in database such as DB2, MYSQL, My SQL Server and
Sybase.
This class is not a fully portable option.
This class generates identifiers of type long, short or int.
Example:
<generator class=“identity“/>
</id>
The sequence class uses a sequence in databases such as DB2, PostgreSQL, Oracle, SAP DB.
This class is not a fully portable option.
This class generates identifiers of type long, short or int.
Example:
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 54
Sathya Technologies
<generator class=“sequence“>
</generator>
</id>
The hilo class uses a hi/lo algorithm to efficiently and portably maintain and generate
identifiers that are unique to that database.
It uses a database table and columns as source of hi values to generate unique identifiers.
This class generates identifiers of type long, short or int.
Example:
The uuid class uses a 128-bit UUID algorithm to generate identifiers, unique with in a
network.
The uuid class attempts to portably generate a unique primary key value, which is
composed of the following:
The local IP address
The startup time of JVM
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 55
Sathya Technologies
The native class selects one of the following depending upon the capabilities of the
underlying database:
Identity
Sequence
Hilo
The assigned class allows the application to assign an identifier to the object before invoking
the save() method. The assigned class is invoked, by default, if no <generator> element is
specified.
<composite-id> Element:
Composite Identifiers (key) are primary key identifiers for classes that consist of more than
one primary key column.
For a table with a composite key, the <composite-id> element allows mapping multiple
properties of the class as identifier properties.
It accepts <key-property> property mappings and <key-many-to-one> mappings as child
elements.
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 56
Sathya Technologies
Project 5: CompositApp
Book.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 57
Sathya Technologies
book.hbm.xml
hibernate.cfg.xml
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 58
Sathya Technologies
MainProgram.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 59
Sathya Technologies
Folder Structure:
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 60
Sathya Technologies
Hibernate Query Language (HQL) is an object-oriented query language, similar to SQL, but
instead of operating on tables and columns, HQL works with persistent objects and their properties. HQL
queries are translated by Hibernate into conventional SQL queries which in turns perform action on
database.
Although you can use SQL statements directly with Hibernate using Native SQL but I would
recommend to use HQL whenever possible to avoid database portability hassles, and to take advantage
of Hibernate's SQL generation and caching strategies.
Keywords like SELECT , FROM and WHERE etc. are not case sensitive but properties like table
and column names are case sensitive in HQL.
FROM Clause:
You will use FROM clause if you want to load a complete persistent objects into memory. Following is
the simple syntax of using FROM clause:
AS Clause:
The AS clause can be used to assign aliases to the classes in your HQL queries, specially when you have
long queries. For instance, our previous simple example would be the following:
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 61
Sathya Technologies
SELECT Clause:
The SELECT clause provides more control over the result set than the from clause. If you want to obtain
few properties of objects instead of the complete object, use the SELECT clause. Following is the simple
syntax of using SELECT clause to get just first_name field of the Employee object:
If you want to narrow the specific objects that are returned from storage, you use the WHERE clause.
Following is the simple syntax of using WHERE clause:
ORDER BY Clause:
To sort your HQL query's results, you will need to use the ORDER BY clause. You can order the results by
any property on the objects in the result set either ascending (ASC) or descending (DESC). Following is
the simple syntax of using ORDER BY clause:
String hql = "FROM Employee E WHERE E.id > 10 ORDER BY E.salary DESC";
Query query = session.createQuery(hql);
List results = query.list();
If you wanted to sort by more than one property, you would just add the additional properties to the
end of the order by clause, separated by commas as follows:
String hql = "FROM Employee E WHERE E.id > 10 " +
"ORDER BY E.firstName DESC, E.salary DESC ";
Query query = session.createQuery(hql);
List results = query.list();
GROUP BY Clause:
This clause lets Hibernate pull information from the database and group it based on a value of an
attribute and, typically, use the result to include an aggregate value. Following is the simple syntax of
using GROUP BY clause:
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 62
Sathya Technologies
Hibernate supports named parameters in its HQL queries. This makes writing HQL queries that accept
input from the user easy and you do not have to defend against SQL injection attacks. Following is the
simple syntax of using named parameters:
UPDATE Clause:
Bulk updates are new to HQL with Hibernate 3, and deletes work differently in Hibernate 3 than they did
in Hibernate 2. The Query interface now contains a method called executeUpdate() for executing HQL
UPDATE or DELETE statements.
The UPDATE clause can be used to update one or more properties of an one or more objects. Following
is the simple syntax of using UPDATE clause:
DELETE Clause:
The DELETE clause can be used to delete one or more objects. Following is the simple syntax of using
DELETE clause:
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 63
Sathya Technologies
INSERT Clause:
HQL supports INSERT INTO clause only where records can be inserted from one object to another object.
Following is the simple syntax of using INSERT INTO clause:
Aggregate Methods:
HQL supports a range of aggregate methods, similar to SQL. They work the same way in HQL as in SQL
and following is the list of the available functions:
The distinct keyword only counts the unique values in the row set. The following query will return only
unique count:
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 64
Sathya Technologies
Project : HQLApp
Student.java
Student.hbm.xml
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 65
Sathya Technologies
hibernate.cfg.xml
MainProgram.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 66
Sathya Technologies
Folder Structure:
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 67
Sathya Technologies
CRITERIA
Hibernate provides alternate ways of manipulating objects and in turn data available in RDBMS tables.
One of the methods is Criteria API which allows you to build up a criteria query object programmatically
where you can apply filtration rules and logical conditions.
The Hibernate Session interface provides createCriteria() method which can be used to create
a Criteria object that returns instances of the persistence object's class when your application executes a
criteria query.
Following is the simplest example of a criteria query is one which will simply return every object that
corresponds to the Employee class.
Criteria cr = session.createCriteria(Employee.class);
List results = cr.list();
Restrictions with Criteria:
You can use add() method available for Criteria object to add restriction for a criteria query. Following is
the example to add a restriction to return the records with salary is equal to 2000:
Criteria cr = session.createCriteria(Employee.class);
cr.add(Restrictions.eq("salary", 2000));
List results = cr.list();
Following are the few more examples covering different scenarios and can be used as per requirement:
Criteria cr = session.createCriteria(Employee.class);
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 68
Sathya Technologies
cr.add(Restrictions.isNull("salary"));
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 69
Sathya Technologies
Project : CriteriaApp
Student.java
Student.hbm.xml
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 70
Sathya Technologies
hibernate.cfg.xml
MainProgram.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 71
Sathya Technologies
Folder Structure:
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 72
Sathya Technologies
In this approach we map the entire class hierarchy to a single table, i.e., a single table is
used to represent the entire class hierarchy.
This table includes columns for the properties for all classes in the hierarchy.
This approach of inheritance mapping is basic, easier to use, and efficient compared to
the other two approaches.
This way of configuring the subclasses is best to use when we are designing our
application top-down approach; that means we design the domain model and then
design a SQL schema accordingly.
However, this approach suffers from one major problem—the columns for properties
declared by subclasses must be declared to accept null values, i.e., these columns
cannot be declared with NOT NULL constraint.
This limitation may cause serious problems for data integrity.
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 73
Sathya Technologies
For above hierarchy it generates a table with all attributes as a single table as shown
below.
Project : PerHibrarchyApp
Employee.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 74
Sathya Technologies
Regular_Employee.java
Contract_Employee.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 75
Sathya Technologies
employee.hbm.xml
Hibernate.cfg.xml
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 76
Sathya Technologies
MainProgram.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 77
Sathya Technologies
Folder structure:
Note:
Here, an extra column (also known as discriminator column) is created in the table to identify
the class.
In case of table per class hierarchy an discriminator column is added by the hibernate
framework that specifies the type of the record. It is mainly used to distinguish the record. To
specify this, discriminator subelement of class must be specified.
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 78
Sathya Technologies
In this approach we map the class hierarchy to multiple tables associated with the relational
foreign key.
All the classes in the hierarchy that declare the persistent properties (including abstract classes)
are mapped to a separate table.
For above hierarchy it generates a table for each class with given attributes as shown
below.
Table : emp
Table: reg_emp
Table :contract_emp
In Hibernate, we use <joined-subclass> element to indicate the table per subclass mapping.
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 79
Sathya Technologies
The <joined-subclass> includes two important attributes to specify the subclass and table
name.
The <joined-subclass> encloses the mapping definition for all the properties declared in the
joined subclass.
Project : PerSubClassApp
Employee.java
Regular_Employee.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 80
Sathya Technologies
Contract_Employee.java
employee.hbm.xml
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 81
Sathya Technologies
Hibernate.cfg.xml
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 82
Sathya Technologies
MainProgram.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 83
Sathya Technologies
Folder Structure:
Note:
The joined-subclass subelement of class, specifies the subclass. The key subelement of joined-
subclass is used to generate the foreign key in the subclass mapped table. This foreign key will
be associated with the primary key of parent class mapped table
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 84
Sathya Technologies
In this approach we map the class hierarchy to a multiple tables with no relation.
We use one table for each concrete (non-abstract) class in the hierarchy, declaring the columns
for all the persistent properties declared by the class and inherited from its superclass.
For above hierarchy it generates a table for each non abstract class with given attributes
as shown below.
Table : emp
Table: reg_emp
Table: contract_emp
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 85
Sathya Technologies
Project : PerConcreetClassApp
Employee.java
Regular_Employee.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 86
Sathya Technologies
Contract_Employee.java
employee.hbm.xml
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 87
Sathya Technologies
Hibernate.cfg.xml
MainProgram.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 88
Sathya Technologies
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 89
Sathya Technologies
Folder Structure:
Note:
The union-subclass subelement of class, specifies the subclass. It adds the columns of parent table into
this table. In other words, it is working as a union.
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 90
Sathya Technologies
ASSOCIATION MAPPING
Association Mapping is a concept of handling relationship between the objects of different
types.
Example: We might design Faculty object to represent the Faculty details. Each Faculty object might be
associated with one Address object; similarly, we might even design Dept object to represent
department details where a Dept object might be associated with many number of Faculty objects.
One-to-One: In this case one entity object is exactly related to one object of another entity. An
example of this is the relationship between a Faculty and his PersonalDetails.
One-to-Many: In this type of relation one entity object is related to many objects of another
entity. An example of this is the relationship between a department and the Faculty working in
that department.
Many-to-One: In this type relation many objects of an entity are related to one object of
another entity. An example of this is the relationship between employee and their project.
There may be many employees working for a single project.
Many-to-Many: In this type of relation many objects of any entity are related to many objects of
another entity. An example of this is the relationship between Student and courses. There may
be many Student registered for one course and likewise a Student can register for multiple
courses.
1.One-to-One:
Considering that One Faculty must have one record of personal details. Here Faculty and
PersonalDetails are two classes, for them I took two tables faculty,personal.
Fig: one-to-one
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 91
Sathya Technologies
Project: One2OneApp
Faculty.java
faculty.hbm.xml
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 92
Sathya Technologies
PersonalDetails.java
personaldetails.hbm.xml
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 93
Sathya Technologies
hibernate.cfg.xml
MainProgram.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 94
Sathya Technologies
Folder Structure:
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 95
Sathya Technologies
Table : Faculty
Table: Personal
2.One-to-Many:
Considering that One Faculty is having more than one Address details like permanent, temporary,
office etc.. Here Faculty and Address are two classes, for them I took two tables faculty,address.
Fig: one-to-many
Project: One2ManyApp
Faculty.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 96
Sathya Technologies
Address.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 97
Sathya Technologies
faculty.hbm.xml
address.hbm.xml
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 98
Sathya Technologies
MainProgram.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 99
Sathya Technologies
hibernate.cgf.xml
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 100
Sathya Technologies
Folder Structure:
Table: faculty
Table: Address
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 101
Sathya Technologies
3.Many-to-One:
Considering that more than one Employee is working one Project. Here Employee and Project are two
classes, for them I took two tables employee, project.
Project: Many2OneApp
Employee.java
employee.hbm.xml
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 102
Sathya Technologies
Project.java
project.hbm.xml
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 103
Sathya Technologies
MainProgram.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 104
Sathya Technologies
hibernate.cfg.xml
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 105
Sathya Technologies
Folder Structure:
Table: Employee
Table : Project
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 106
Sathya Technologies
4.Many-to-Many:
Considering that more than one Student is pursuing more than one Course. Here Student and Course
are two classes, for them I took two tables student, course.
Project: Many2ManyApp
Student.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 107
Sathya Technologies
student.hbm.xml
Course.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 108
Sathya Technologies
course.hbm.xml
hibernate.cfg.xml
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 109
Sathya Technologies
MainProgram.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 110
Sathya Technologies
Folder Structure:
Table: Student
Table: Course
Table: stdcourse
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 111
Sathya Technologies
HIBERNATE ANNOTATIONS
The hibernate application can be created with annotation. There are many annotations that can
be used to create hibernate application such as @Entity, @Id, @Table etc.
Hibernate Annotations are based on the JPA 2 specification and supports all the features.
All the JPA annotations are defined in the javax.persistence.* package. Hibernate EntityManager
implements the interfaces and life cycle defined by the JPA specification.
The core advantage of using hibernate annotation is that you don't need to create mapping
(hbm) file. Here, hibernate annotations are used to provide the meta data.
Example :
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 112
Sathya Technologies
Project : AnnotationApp
Student.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 113
Sathya Technologies
Hibernate.cfg.xml:
MainProgram.java
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 114
Sathya Technologies
Folder Structure:
Sri Sai Arcade, Ameerpet, Hyderabad. Ph : 040 – 65538958 / 68 / 78, www.sathyatech.com Page 115