SlideShare a Scribd company logo
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
By Dinesh Radadiya
Hibernate Basics
By Jainesh Trivedi
© 2015 KNOWARTH
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
© 2013 Knowarth
Agenda
2
 Introduction to Hibernate and ORM
 Arcitecture
 Hibernate Configuration
 Annotations, Mappings and HQL
 Cascade
 Caching
 Interceptors
© 2015 KNOWARTH
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
3
Introduction
© 2015 KNOWARTH
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
© 2013 Knowarth
Introduction
4
 High Performance Object/Relational mapping solution and
queryservice
 Open Source Persistence Framework created by Gavin King in
2001.
 Takes care of mapping of Java datatypes and SQL type.
 It also maps Java classes to the database tables.
© 2015 KNOWARTH
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
© 2013 Knowarth 55
Introduction
 Programming code that converts data between
database and OO Languages.
 ORM Advantages:-
 Allows business code to acces objects instead of DB
tables.
 Entities based on business structure instead of DB.
 Hides details of SQL queries.
 No need to deal with database implementation.
© 2015 KNOWARTH
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
© 2013 Knowarth 6
Hibernate Architecture
Hibernate Architecture
© 2015 KNOWARTH
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
© 2013 Knowarth 7
Hibernate Architecture
© 2015 KNOWARTH
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
© 2013 Knowarth 8
Hibernate Architecture
● Configuration Object
● SessionFactory Object
● Session Object
● Transaction Object
● Query Object
● Criteria Object
© 2015 KNOWARTH
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
© 2013 Knowarth 9
Hibernate Architecture
● Criteria criteria =
session.createCriteria(StockDailyRecord.class);
● .addOrder(Order.asc(“date”));
● Restrictions in criteria object:
lt,ge,gt,le,isNull,like,isNotNull,between,etc
● .add(Restrictions.like(“Name”,”Know%”))
© 2015 KNOWARTH
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
© 2013 Knowarth 10
Hibernate Architecture
● Downloading Hibernate:
– Download the latest version of
Hibernate http://www.hibernate.org/do
wnloads
© 2015 KNOWARTH
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
1111
Hibernate Configuration
© 2015 KNOWARTH
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
© 2013 Knowarth
Hibernate Configuration
12
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Connection to Oracle db -->
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:xe</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hibernate.connection.username">test</property>
<property name="hibernate.connection.password">test123</property>
<!-- Auto commit to false -->
<property name="hibernate.connection.autocommit">false</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.format_sql">true</property>
<property name="hibernate.use_sql_comments">true</property>
</session-factory>
</hibernate-configuration>
© 2015 KNOWARTH
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
1313
Annotations,Mapping and HQL
© 2014 Knowarth
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
© 2013 Knowarth
Annotations,Mapping and HQL
14
– One to One
– One to Many
– Many to One
– Many to Many
© 2015 KNOWARTH
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
© 2013 Knowarth
Annotations,Mapping and HQL
15
 Powerful tool to define mapping without XML
files,one can use annotations with or as a
replacement to XML files
 Enviornment Setup for annotations:-
● Install Hiberanate 3.X annotations package to
use annoations for mapping.
 @Entity,@Table,@Id,@GeneratedValue,@Column are
some of the basic annoations
© 2015 KNOWARTH
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
© 2013 Knowarth
Annotations,Mapping and HQL
16
 Hibernate Query Language is a query language
similar to SQL but operates on objects instead of
table and column
 HQL queries are translated to conventional SQL
queries which inturn perform the operations.
 HQL makes use of persistent objects and their
properties to operate.
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
17
Examples
© 2015 KNOWARTH
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
© 2013 Knowarth
Cascade
18
● Cascade is an important feature provided by Hibernate using
which one can manage state of other objects related to a
particular object.
● Its like propogating the change to all the interlinked objects by
just applying the change to the parent object.
● Cascading can be used to easily maintain the consistency but it
should be used wisely inorder to avoid unnecessary cascade
affects.
© 2015 KNOWARTH
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
© 2013 Knowarth
Native SQL
19
 Hibernate provides a method createSQL() to make native SQL
statement directly.
 One can use native calls to insert,update,delete and load date
using this and we can use stored procedures.
Query query = session.createSQLQuery(
"select * from stock s where s.stock_code = :stockCode")
.addEntity(Stock.class)
.setParameter("stockCode", "7277");
List result = query.list();
© 2015 KNOWARTH
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
© 2013 Knowarth
Caching
20
 Caching is basically used to enhance the system performance
by reducing the number of database hits.
 Hibernate cache sits between the database and your
application.
© 2015 KNOWARTH
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
© 2013 Knowarth
Caching
21
First-level cache:
● Always associates with the Session object. Hibernate uses this
cache by default.
● Its easy to understand the first level cache if we understand the fact
that it is associated with Session object.
● When we query an entity first time, it is retrieved from database and
stored in first level cache associated with hibernate session.
● The loaded entity can be removed from session using evict()
method. The next loading of this entity will again make a database
call if it has been removed using evict() method.
● The whole session cache can be removed using clear() method. It
will remove all the entities stored in cache.
© 2015 KNOWARTH
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
© 2013 Knowarth
Caching
22
Second-level cache:
● Always associates with sessionFactoryObject and is available to be
● used in all sessions which are created using that particular session
factory.
● Second level cache is an optional cache and first-level cache will
always be consulted before any attempt is made to locate an object in
the Second-level cache.
● Any third-party cache can be used with Hibernate.
An org.hibernate.cache.CacheProvider interface is provided
<property name="hibernate.cache.use_second_level_cache">true</property>
<property
name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider
</property>
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
© 2013 Knowarth
Caching
23
To use the query cache, you use the setCacheable(Boolean) method of the
Query class.
© 2015 KNOWARTH
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
© 2013 Knowarth 24
Interceptors
© 2015 KNOWARTH
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
© 2013 Knowarth 25
Interceptors
● As we know that in Hibernate, an object will be created and persisted. Once the
object has been changed, it must be saved back to the database.
● Thus the object passed through different stages of life-cycle before been saved,
so interceptors provide methods that can be used to manipulate objects during
the different stages of life cyle.
● These methods are callbacks from the session to the application, allowing the
application to inspect and/or manipulate properties of a persistent object before
it is saved, updated, deleted or loaded.
● To build a custom interceptor one can do it by simply implementing the
Interceptor interface or extend the EmptyInterceptor class.
© 2015 KNOWARTH
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
© 2013 Knowarth 26
Interceptors
● Methods in interceptors
© 2015 KNOWARTH
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
© 2013 Knowarth
Query & Questions
27© 2015 KNOWARTH
SLIDE TITLE
 Click to edit Master text styles
 Second level
 Third level
 Fourth level
 Fifth level
THANK YOU
© 2015 KNOWARTH

More Related Content

PPTX
Containerized MySQL OpenWorld talk
PPT
Introduction to NHibernate
PPTX
NHibernate for .NET
PPTX
NHibernate
PDF
NHibernate (The ORM For .NET Platform)
PPS
Dacj 4 1-b
PPS
Introduction To NHibernate
PPTX
Introduction to MongoDB
Containerized MySQL OpenWorld talk
Introduction to NHibernate
NHibernate for .NET
NHibernate
NHibernate (The ORM For .NET Platform)
Dacj 4 1-b
Introduction To NHibernate
Introduction to MongoDB

Viewers also liked (13)

PDF
NodeJS - KNOWARTH
PDF
Web Framework and Struts 2 - KNOWARTH
PPTX
Java 8 - KNOWARTH
PPT
Bootstrap - KNOWARTH
PDF
MongoDB - KNOWARTH
PPTX
Presentacion de blacbord
PPTX
Basics of Spring - KNOWARTH
PPTX
Angular JS - KNOWARTH
PPT
Introduction to Magento - KNOWARTH
PDF
Green movement 2012 candidate review
PPTX
VMWare based Cloud Computing - KNOWARTH
PDF
Swimming Pool Design
PPTX
Mechanical analysis of soil
NodeJS - KNOWARTH
Web Framework and Struts 2 - KNOWARTH
Java 8 - KNOWARTH
Bootstrap - KNOWARTH
MongoDB - KNOWARTH
Presentacion de blacbord
Basics of Spring - KNOWARTH
Angular JS - KNOWARTH
Introduction to Magento - KNOWARTH
Green movement 2012 candidate review
VMWare based Cloud Computing - KNOWARTH
Swimming Pool Design
Mechanical analysis of soil
Ad

Similar to Hibernate - KNOWARTH (20)

PDF
PPTX
Cassandra Day Atlanta 2015: BetterCloud: Leveraging Apache Cassandra
PDF
Html5 - Tutorial
PDF
Html5 tutorial
PDF
Owner - Java properties reinvented.
ODP
Hibernate complete Training
ODP
Doc store
PDF
Building a Custom Theme in Drupal 8
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Introduction to javascript, internal inline external
PDF
Apache - Mod-Rewrite
PPTX
Obevo Javasig.pptx
PPTX
Dsc Charusat Learning React Part 1
PDF
html5 _ Fundamentals a Basic Concepts of Understanding HTML.pdf
PPTX
Adam Sanyo - Conref, conkeyref, conrefpush: Reuse strategies when working on ...
PPTX
"Conref, conkeyref, conrefpush" - reuse strategies in DITA when migrating leg...
PDF
Html5 tutorial
PDF
Html5 tutorial
PDF
Html5 tutorial
PDF
Html5 tutorial
Cassandra Day Atlanta 2015: BetterCloud: Leveraging Apache Cassandra
Html5 - Tutorial
Html5 tutorial
Owner - Java properties reinvented.
Hibernate complete Training
Doc store
Building a Custom Theme in Drupal 8
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Introduction to javascript, internal inline external
Apache - Mod-Rewrite
Obevo Javasig.pptx
Dsc Charusat Learning React Part 1
html5 _ Fundamentals a Basic Concepts of Understanding HTML.pdf
Adam Sanyo - Conref, conkeyref, conrefpush: Reuse strategies when working on ...
"Conref, conkeyref, conrefpush" - reuse strategies in DITA when migrating leg...
Html5 tutorial
Html5 tutorial
Html5 tutorial
Html5 tutorial
Ad

Recently uploaded (20)

PPTX
A Presentation on Artificial Intelligence
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Electronic commerce courselecture one. Pdf
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Spectroscopy.pptx food analysis technology
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPT
Teaching material agriculture food technology
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Machine Learning_overview_presentation.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Big Data Technologies - Introduction.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
A Presentation on Artificial Intelligence
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Electronic commerce courselecture one. Pdf
A comparative analysis of optical character recognition models for extracting...
gpt5_lecture_notes_comprehensive_20250812015547.pdf
sap open course for s4hana steps from ECC to s4
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Encapsulation_ Review paper, used for researhc scholars
Spectroscopy.pptx food analysis technology
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Teaching material agriculture food technology
Network Security Unit 5.pdf for BCA BBA.
Machine Learning_overview_presentation.pptx
MIND Revenue Release Quarter 2 2025 Press Release
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Assigned Numbers - 2025 - Bluetooth® Document
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Big Data Technologies - Introduction.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm

Hibernate - KNOWARTH

  • 1. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level By Dinesh Radadiya Hibernate Basics By Jainesh Trivedi © 2015 KNOWARTH
  • 2. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level © 2013 Knowarth Agenda 2  Introduction to Hibernate and ORM  Arcitecture  Hibernate Configuration  Annotations, Mappings and HQL  Cascade  Caching  Interceptors © 2015 KNOWARTH
  • 3. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level 3 Introduction © 2015 KNOWARTH
  • 4. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level © 2013 Knowarth Introduction 4  High Performance Object/Relational mapping solution and queryservice  Open Source Persistence Framework created by Gavin King in 2001.  Takes care of mapping of Java datatypes and SQL type.  It also maps Java classes to the database tables. © 2015 KNOWARTH
  • 5. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level © 2013 Knowarth 55 Introduction  Programming code that converts data between database and OO Languages.  ORM Advantages:-  Allows business code to acces objects instead of DB tables.  Entities based on business structure instead of DB.  Hides details of SQL queries.  No need to deal with database implementation. © 2015 KNOWARTH
  • 6. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level © 2013 Knowarth 6 Hibernate Architecture Hibernate Architecture © 2015 KNOWARTH
  • 7. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level © 2013 Knowarth 7 Hibernate Architecture © 2015 KNOWARTH
  • 8. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level © 2013 Knowarth 8 Hibernate Architecture ● Configuration Object ● SessionFactory Object ● Session Object ● Transaction Object ● Query Object ● Criteria Object © 2015 KNOWARTH
  • 9. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level © 2013 Knowarth 9 Hibernate Architecture ● Criteria criteria = session.createCriteria(StockDailyRecord.class); ● .addOrder(Order.asc(“date”)); ● Restrictions in criteria object: lt,ge,gt,le,isNull,like,isNotNull,between,etc ● .add(Restrictions.like(“Name”,”Know%”)) © 2015 KNOWARTH
  • 10. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level © 2013 Knowarth 10 Hibernate Architecture ● Downloading Hibernate: – Download the latest version of Hibernate http://www.hibernate.org/do wnloads © 2015 KNOWARTH
  • 11. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level 1111 Hibernate Configuration © 2015 KNOWARTH
  • 12. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level © 2013 Knowarth Hibernate Configuration 12 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <!-- Connection to Oracle db --> <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property> <property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:xe</property> <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property> <property name="hibernate.connection.username">test</property> <property name="hibernate.connection.password">test123</property> <!-- Auto commit to false --> <property name="hibernate.connection.autocommit">false</property> <property name="hibernate.show_sql">true</property> <property name="hibernate.format_sql">true</property> <property name="hibernate.use_sql_comments">true</property> </session-factory> </hibernate-configuration> © 2015 KNOWARTH
  • 13. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level 1313 Annotations,Mapping and HQL © 2014 Knowarth
  • 14. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level © 2013 Knowarth Annotations,Mapping and HQL 14 – One to One – One to Many – Many to One – Many to Many © 2015 KNOWARTH
  • 15. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level © 2013 Knowarth Annotations,Mapping and HQL 15  Powerful tool to define mapping without XML files,one can use annotations with or as a replacement to XML files  Enviornment Setup for annotations:- ● Install Hiberanate 3.X annotations package to use annoations for mapping.  @Entity,@Table,@Id,@GeneratedValue,@Column are some of the basic annoations © 2015 KNOWARTH
  • 16. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level © 2013 Knowarth Annotations,Mapping and HQL 16  Hibernate Query Language is a query language similar to SQL but operates on objects instead of table and column  HQL queries are translated to conventional SQL queries which inturn perform the operations.  HQL makes use of persistent objects and their properties to operate.
  • 17. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level 17 Examples © 2015 KNOWARTH
  • 18. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level © 2013 Knowarth Cascade 18 ● Cascade is an important feature provided by Hibernate using which one can manage state of other objects related to a particular object. ● Its like propogating the change to all the interlinked objects by just applying the change to the parent object. ● Cascading can be used to easily maintain the consistency but it should be used wisely inorder to avoid unnecessary cascade affects. © 2015 KNOWARTH
  • 19. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level © 2013 Knowarth Native SQL 19  Hibernate provides a method createSQL() to make native SQL statement directly.  One can use native calls to insert,update,delete and load date using this and we can use stored procedures. Query query = session.createSQLQuery( "select * from stock s where s.stock_code = :stockCode") .addEntity(Stock.class) .setParameter("stockCode", "7277"); List result = query.list(); © 2015 KNOWARTH
  • 20. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level © 2013 Knowarth Caching 20  Caching is basically used to enhance the system performance by reducing the number of database hits.  Hibernate cache sits between the database and your application. © 2015 KNOWARTH
  • 21. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level © 2013 Knowarth Caching 21 First-level cache: ● Always associates with the Session object. Hibernate uses this cache by default. ● Its easy to understand the first level cache if we understand the fact that it is associated with Session object. ● When we query an entity first time, it is retrieved from database and stored in first level cache associated with hibernate session. ● The loaded entity can be removed from session using evict() method. The next loading of this entity will again make a database call if it has been removed using evict() method. ● The whole session cache can be removed using clear() method. It will remove all the entities stored in cache. © 2015 KNOWARTH
  • 22. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level © 2013 Knowarth Caching 22 Second-level cache: ● Always associates with sessionFactoryObject and is available to be ● used in all sessions which are created using that particular session factory. ● Second level cache is an optional cache and first-level cache will always be consulted before any attempt is made to locate an object in the Second-level cache. ● Any third-party cache can be used with Hibernate. An org.hibernate.cache.CacheProvider interface is provided <property name="hibernate.cache.use_second_level_cache">true</property> <property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider </property>
  • 23. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level © 2013 Knowarth Caching 23 To use the query cache, you use the setCacheable(Boolean) method of the Query class. © 2015 KNOWARTH
  • 24. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level © 2013 Knowarth 24 Interceptors © 2015 KNOWARTH
  • 25. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level © 2013 Knowarth 25 Interceptors ● As we know that in Hibernate, an object will be created and persisted. Once the object has been changed, it must be saved back to the database. ● Thus the object passed through different stages of life-cycle before been saved, so interceptors provide methods that can be used to manipulate objects during the different stages of life cyle. ● These methods are callbacks from the session to the application, allowing the application to inspect and/or manipulate properties of a persistent object before it is saved, updated, deleted or loaded. ● To build a custom interceptor one can do it by simply implementing the Interceptor interface or extend the EmptyInterceptor class. © 2015 KNOWARTH
  • 26. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level © 2013 Knowarth 26 Interceptors ● Methods in interceptors © 2015 KNOWARTH
  • 27. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level © 2013 Knowarth Query & Questions 27© 2015 KNOWARTH
  • 28. SLIDE TITLE  Click to edit Master text styles  Second level  Third level  Fourth level  Fifth level THANK YOU © 2015 KNOWARTH

Editor's Notes

  • #5: Purpose of MVC is separate out each layer so application become easily scalable For example you want to change look of your application only view gets impacted if all 3 layers are properly seperated