SlideShare a Scribd company logo
www.edureka.co/persistence-with-hibernate
Hibernate Mapping on the Fly
View Persistence with Hibernate course details at www.edureka.co/persistence-with-hibernate
For Queries:
Post on Twitter @edurekaIN: #askEdureka
Post on Facebook /edurekaIN
For more details please contact us:
US : 1800 275 9730 (toll free)
INDIA : +91 88808 62004
Email Us : sales@edureka.co
Slide 2 www.edureka.co/persistence-with-hibernate
Batch Processing in Hibernate
Application Performance Optimization with Caching
Bring the Power of Search to your Hibernate App
How to Validate Application Constraints
At the end of this module, you will be able to understand:
Objectives
Slide 3 www.edureka.co/persistence-with-hibernate
Hibernate
 An Object relational mapping library of java language for Object persistence and SQL databases
Transparent persistence of java objects with relational database
Provides query language in sync with SQL
Open source library
Provides solutions for object relational impedance mismatch problems
Slide 4 www.edureka.co/persistence-with-hibernate
 Objective is to solve the complexities existed in
EJB2 persistence architecture
 Provided an effective Java persistence API
enabling hibernate to work with different
databases easily
 Annotations provide meta data about table
column definitions at the model level
 Entities are developed independent of the
underlying database
JavaEE with Hibernate
Derby
MySQL
Oracle
HIBERNATE
Slide 5 www.edureka.co/persistence-with-hibernate
Provides a simple API for storing and retrieving Java objects directly to and from the database
Non-intrusive: No need to follow specific rules or design patterns
Transparent: Your object model is unaware
ORM using Hibernate
JavaObject
int id;
String name;
String getName()
int getId()
void setName(String)
SQL Table
id [int] primary key,
name [varchar(50)],
Magic Happens Here
(O/R Mapper – i.e. Hibernate)
Slide 6 www.edureka.co/persistence-with-hibernate
Batch Processing
Processing bulk records into database in a particular time is called batch processing
Processing bulk records is a tedious task because CRUD has to be performed in all the records in a sequence
With the help of batch processing running program multiple times can be avoided
For multiple transactions code will be run only once instead of running for each transaction
Slide 7 www.edureka.co/persistence-with-hibernate
Memory Issue
Since hibernate caches the objects
will it result in
OutOfMemoryException.
If that’s the case how to avoid it?
Slide 8 www.edureka.co/persistence-with-hibernate
Batch Processing with Hibernate
Since hibernate caches persistent objects it will end up in out of memory for huge records
In order to overcome this hibernate has configurations defined internally
By configuring hibernate to insert the rows in batch, one can achieve batch processing in hibernate
One can also disable the cache of hibernate during the process
hibernate.jdbc.batch_size 50
hibernate.cache.use_second_level_cache false
Slide 9 www.edureka.co/persistence-with-hibernate
DEMO - Batch Processing With Hibernate
Slide 10 www.edureka.co/persistence-with-hibernate
Hibernate Caching
Caching is used in-order to improve the performance of
applications
Effectively used by hibernate for caching at object level as well
as the query level
Improves performance by caching objects which in turn reduces
the database hits to a greater extent
Techniques used for Caching in hibernate are
» First-level Cache
» Second-level Cache
» Query level cache
Database
First-level Cache
Session Object
Second-level Cache
Client
Hibernate
Slide 11 www.edureka.co/persistence-with-hibernate
Types of Caching
First Level Cache
Data are cached at the session level
Default cache of hibernate
Cached objects exists as long as session is active
Mandatory cache used by hibernate across all applications
Second Level Cache
An optional cache
Cache at the session factory level
Not enabled by default hence need to enable it explicitly
Second Level Cache implementations :
» EHCache
» Swarm Cache
» OS Cache
» JBoss Cache
Query Level Cache
Enabled by hibernate.cache.use_query_cache="true“
Holds the complete query result in cache
Slide 12 www.edureka.co/persistence-with-hibernate
Hibernate First Level Cache
Database
Hibernate Session Load
Hibernate Session
Is Data Available in
Session
YES
NO
Slide 13 www.edureka.co/persistence-with-hibernate
NO
NO
Is Data Available in
Session Factory
Database
Hibernate Session Load
Hibernate SessionIs Data Available in
Session
YES
Hibernate Second Level Cache
Hibernate Session Factory
YES
Slide 14 www.edureka.co/persistence-with-hibernate
DEMO - Optimizing performance using cache
Slide 15 www.edureka.co/persistence-with-hibernate
Lucene – Full text search
An Apache library
Full text search capability
Developed on java API
Query results are returned by relevance
Fast, flexible and stable
Easy to integrate lucence search functionality to application..
Slide 16 www.edureka.co/persistence-with-hibernate
How hibernate can perform search
on the database with lucene, as
lucene can do effective searching
on file system
Hibernate and Lucene Together
Slide 17 www.edureka.co/persistence-with-hibernate
Hibernate Search
Even though Lucence provides very efficient search
capabilities, suffers with several mismatches with
domain object models
Hibernate Search built on top of the Lucence search
engine to address the short comings of lucence in
domain object models.
Similarly to Hibernate which has been built in top of
the SQL databases , Hibernate search built on top of
Lucence
Hibernate address the short comings of lucence in
domain object models with annotations
Manages entities when query made to database or as
lucence query to index
Hibernate
+
Hibernate Search
Database
Lucence
(Index)
Search
Request
Slide 18 www.edureka.co/persistence-with-hibernate
Hibernate Search Dependencies
Hibernate search dependencies are provided in the
hibernate-search-4.5.2.Final.jar
Dependencies can be downloaded from the
following locations
http://sourceforge.net/projects/hibernate/files/hiberna
te-search/
http://repository.jboss.org/nexus/content/groups/publi
c-jboss/org/hibernate/
Other required dependencies for hibernate search
are available from the following location
http://sourceforge.net/projects/hibernate/files/hiberna
te4/
Slide 19 www.edureka.co/persistence-with-hibernate
Hibernate Search Query DSL
Easy and efficient API for hibernate search
Queries are created via QueryBuilder with the help of SearchFactory
QueryBuilder is an interface from the package org.hibernate.search.query.dsl
Once created can be easily attached with an entity
Queries are created on top of QueryBuilder
QueryBuilder queryBuilder =
searchFactory.buildQueryBuilder().forEntity(MyEntity.class).get();
builder.range().onField("numberOfPages").above(1000).excludeLimit().createQuery();
Slide 20 www.edureka.co/persistence-with-hibernate
DEMO - Hibernate Search
Slide 21 www.edureka.co/persistence-with-hibernate
Validation of Beans
Process of verifying data follows pre-defined constraints
Validations of beans are basically constraints on object models via annotations
Validations can also be defined with custom constraints
Since bean validation is a java specification effective APIs can be used for validating the beans
Validations of beans has to done on or before persistence of data in-order to maintain data integrity
Slide 22 www.edureka.co/persistence-with-hibernate
Validation in Applications
Validations can be applied at any stage of
application
Validation can be applied at the web layer
,service layer or at the repository layer
Custom constraints can be applied with
custom validations
Generally validations are preferred more in
repository layer to maintain data integrity
Web/Presentation
Database
Service
Repository
Users
Validations
Slide 23 www.edureka.co/persistence-with-hibernate
Constraints
Restrictions/Conditions applied at fields
Belongs to javax.validation.constraints
Applied on top of fields with annotations like
@NotNull, @Min etc.
Can be applied at field, class and property
AssertFalse The annotated element must be false.
AssertFalse.List
Defines several @AssertFalse annotations on the same
element
AssertTrue The annotated element must be true.
AssertTrue.List Defines several @AssertTrue annotations on the same element
DecimalMax
The annotated element must be a number whose value must
be lower or equal to the specified maximum.
DecimalMax.List
Defines several @DecimalMax annotations on the same
element
DecimalMin
The annotated element must be a number whose value must
be higher or equal to the specified minimum.
Reference : http://docs.oracle.com/javaee/6/api/javax/validation/constraints/package-summary.html
Slide 24 www.edureka.co/persistence-with-hibernate
DEMO - Hibernate Validator
Slide 25 www.edureka.co/persistence-with-hibernate
Course Topics
 Module 1
» Introduction to ORM and Hibernate
 Module 2
» Persistence and Session Factory
 Module 3
» Association, Mapping & Inheritance
 Module 4
» Criteria and Query Language
 Module 5
» Transactions ,Filter and Performance
 Module 6
» Search and Validation Framework
 Module 7
» OGM, NoSQL and Spring
 Module 8
» Project
Slide 26
LIVE Online Class
Class Recording in LMS
24/7 Post Class Support
Module Wise Quiz
Project Work
Verifiable Certificate
www.edureka.co/persistence-with-hibernate
How it Works?
Slide 27 www.edureka.co/persistence-with-hibernate
Exclusive
On Persistence with Hibernate Course
To avail this offer please contact us:
US : 1800 275 9730 (toll free)
INDIA : +91 88808 62004
Email Us : sales@edureka.co
Questions
Slide 28 www.edureka.co/persistence-with-hibernate
Slide 29 Course Url

More Related Content

PDF
Webinar: Persistence with Hibernate - Portal Development & Text Searching wit...
PDF
Webinar: Hibernate - the ultimate ORM framework
PDF
Spring Framework - III
PPTX
Spring & hibernate
PDF
Spring Framework -I
PDF
Spring Framework-II
PDF
Enterprise Level Application Architecture with Web APIs using Entity Framewor...
PPTX
Introduction To Building Enterprise Web Application With Spring Mvc
Webinar: Persistence with Hibernate - Portal Development & Text Searching wit...
Webinar: Hibernate - the ultimate ORM framework
Spring Framework - III
Spring & hibernate
Spring Framework -I
Spring Framework-II
Enterprise Level Application Architecture with Web APIs using Entity Framewor...
Introduction To Building Enterprise Web Application With Spring Mvc

What's hot (19)

PPTX
Enterprice java
DOCX
Hibernate notes
DOCX
J2EE Architecture Explained
PPTX
Introduction to ejb and struts framework
PDF
Overview of JEE Technology
PPTX
Entity framework and how to use it
PDF
Hibernate complete notes_by_sekhar_sir_javabynatara_j
PDF
Hibernate I
PDF
Hibernate II
PDF
Hibernate III
PPTX
Entity Framework Overview
PDF
PPTX
Web API with ASP.NET MVC by Software development company in india
PPTX
Introduction to MongoDB
PPT
7) packaging and deployment
PPTX
Java EE EJB Applications
PPT
3) web development
PDF
Lecture 8 Enterprise Java Beans (EJB)
PDF
JSP Technology I
Enterprice java
Hibernate notes
J2EE Architecture Explained
Introduction to ejb and struts framework
Overview of JEE Technology
Entity framework and how to use it
Hibernate complete notes_by_sekhar_sir_javabynatara_j
Hibernate I
Hibernate II
Hibernate III
Entity Framework Overview
Web API with ASP.NET MVC by Software development company in india
Introduction to MongoDB
7) packaging and deployment
Java EE EJB Applications
3) web development
Lecture 8 Enterprise Java Beans (EJB)
JSP Technology I
Ad

Viewers also liked (8)

PDF
Building Web Application Using Spring Framework
PDF
Effective Persistence Using ORM With Hibernate
PPT
Contemporary Software Engineering Practices Together With Enterprise
PDF
Developing Reusable Software Components Using MVP, Observer and Mediator Patt...
PPT
hibernate with JPA
PDF
20160523 hibernate persistence_framework_and_orm
PPT
Intro To Hibernate
PPTX
ER model to Relational model mapping
Building Web Application Using Spring Framework
Effective Persistence Using ORM With Hibernate
Contemporary Software Engineering Practices Together With Enterprise
Developing Reusable Software Components Using MVP, Observer and Mediator Patt...
hibernate with JPA
20160523 hibernate persistence_framework_and_orm
Intro To Hibernate
ER model to Relational model mapping
Ad

Similar to Hibernate Mapping on the Fly (20)

PDF
Leverage Hibernate and Spring Features Together
PDF
Hibernate Interview Questions | Edureka
PDF
Hibernate Interview Questions and Answers
DOC
Hibernate tutorial for beginners
PDF
Building High Performance and Scalable Applications Using AppFabric Cache- Im...
DOCX
02 java spring-hibernate-experience-questions
PPT
Virtual Classroom
PDF
Building great mobile apps: Somethings you might want to know
PPS
Java Hibernate Programming with Architecture Diagram and Example
DOCX
Hibernate3 q&a
PDF
Performance Tips and Tricks: Java EE, Java Persistence API and JavaServer Faces
PDF
Html5 and beyond the next generation of mobile web applications - Touch Tou...
PPT
Hibernate jj
PDF
Handling Relational Data in a Distributed Cache
PDF
Hibernate interview questions
DOCX
Spring review_for Semester II of Year 4
PDF
Tuning and optimizing webcenter spaces application white paper
PPTX
Academy PRO: HTML5 Data storage
PPTX
P20CSP105-AdvJavaProg.pptx
PDF
Java EE 7 Recipes
Leverage Hibernate and Spring Features Together
Hibernate Interview Questions | Edureka
Hibernate Interview Questions and Answers
Hibernate tutorial for beginners
Building High Performance and Scalable Applications Using AppFabric Cache- Im...
02 java spring-hibernate-experience-questions
Virtual Classroom
Building great mobile apps: Somethings you might want to know
Java Hibernate Programming with Architecture Diagram and Example
Hibernate3 q&a
Performance Tips and Tricks: Java EE, Java Persistence API and JavaServer Faces
Html5 and beyond the next generation of mobile web applications - Touch Tou...
Hibernate jj
Handling Relational Data in a Distributed Cache
Hibernate interview questions
Spring review_for Semester II of Year 4
Tuning and optimizing webcenter spaces application white paper
Academy PRO: HTML5 Data storage
P20CSP105-AdvJavaProg.pptx
Java EE 7 Recipes

More from Edureka! (20)

PDF
What to learn during the 21 days Lockdown | Edureka
PDF
Top 10 Dying Programming Languages in 2020 | Edureka
PDF
Top 5 Trending Business Intelligence Tools | Edureka
PDF
Tableau Tutorial for Data Science | Edureka
PDF
Python Programming Tutorial | Edureka
PDF
Top 5 PMP Certifications | Edureka
PDF
Top Maven Interview Questions in 2020 | Edureka
PDF
Linux Mint Tutorial | Edureka
PDF
How to Deploy Java Web App in AWS| Edureka
PDF
Importance of Digital Marketing | Edureka
PDF
RPA in 2020 | Edureka
PDF
Email Notifications in Jenkins | Edureka
PDF
EA Algorithm in Machine Learning | Edureka
PDF
Cognitive AI Tutorial | Edureka
PDF
AWS Cloud Practitioner Tutorial | Edureka
PDF
Blue Prism Top Interview Questions | Edureka
PDF
Big Data on AWS Tutorial | Edureka
PDF
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
PDF
Kubernetes Installation on Ubuntu | Edureka
PDF
Introduction to DevOps | Edureka
What to learn during the 21 days Lockdown | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
Tableau Tutorial for Data Science | Edureka
Python Programming Tutorial | Edureka
Top 5 PMP Certifications | Edureka
Top Maven Interview Questions in 2020 | Edureka
Linux Mint Tutorial | Edureka
How to Deploy Java Web App in AWS| Edureka
Importance of Digital Marketing | Edureka
RPA in 2020 | Edureka
Email Notifications in Jenkins | Edureka
EA Algorithm in Machine Learning | Edureka
Cognitive AI Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
Blue Prism Top Interview Questions | Edureka
Big Data on AWS Tutorial | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Kubernetes Installation on Ubuntu | Edureka
Introduction to DevOps | Edureka

Recently uploaded (20)

PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Empathic Computing: Creating Shared Understanding
PDF
Machine learning based COVID-19 study performance prediction
PDF
Approach and Philosophy of On baking technology
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
Cloud computing and distributed systems.
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Empathic Computing: Creating Shared Understanding
Machine learning based COVID-19 study performance prediction
Approach and Philosophy of On baking technology
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Cloud computing and distributed systems.
sap open course for s4hana steps from ECC to s4
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Digital-Transformation-Roadmap-for-Companies.pptx
Network Security Unit 5.pdf for BCA BBA.
Per capita expenditure prediction using model stacking based on satellite ima...
Understanding_Digital_Forensics_Presentation.pptx
Encapsulation_ Review paper, used for researhc scholars
Reach Out and Touch Someone: Haptics and Empathic Computing
The Rise and Fall of 3GPP – Time for a Sabbatical?
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Chapter 3 Spatial Domain Image Processing.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf

Hibernate Mapping on the Fly

  • 1. www.edureka.co/persistence-with-hibernate Hibernate Mapping on the Fly View Persistence with Hibernate course details at www.edureka.co/persistence-with-hibernate For Queries: Post on Twitter @edurekaIN: #askEdureka Post on Facebook /edurekaIN For more details please contact us: US : 1800 275 9730 (toll free) INDIA : +91 88808 62004 Email Us : sales@edureka.co
  • 2. Slide 2 www.edureka.co/persistence-with-hibernate Batch Processing in Hibernate Application Performance Optimization with Caching Bring the Power of Search to your Hibernate App How to Validate Application Constraints At the end of this module, you will be able to understand: Objectives
  • 3. Slide 3 www.edureka.co/persistence-with-hibernate Hibernate  An Object relational mapping library of java language for Object persistence and SQL databases Transparent persistence of java objects with relational database Provides query language in sync with SQL Open source library Provides solutions for object relational impedance mismatch problems
  • 4. Slide 4 www.edureka.co/persistence-with-hibernate  Objective is to solve the complexities existed in EJB2 persistence architecture  Provided an effective Java persistence API enabling hibernate to work with different databases easily  Annotations provide meta data about table column definitions at the model level  Entities are developed independent of the underlying database JavaEE with Hibernate Derby MySQL Oracle HIBERNATE
  • 5. Slide 5 www.edureka.co/persistence-with-hibernate Provides a simple API for storing and retrieving Java objects directly to and from the database Non-intrusive: No need to follow specific rules or design patterns Transparent: Your object model is unaware ORM using Hibernate JavaObject int id; String name; String getName() int getId() void setName(String) SQL Table id [int] primary key, name [varchar(50)], Magic Happens Here (O/R Mapper – i.e. Hibernate)
  • 6. Slide 6 www.edureka.co/persistence-with-hibernate Batch Processing Processing bulk records into database in a particular time is called batch processing Processing bulk records is a tedious task because CRUD has to be performed in all the records in a sequence With the help of batch processing running program multiple times can be avoided For multiple transactions code will be run only once instead of running for each transaction
  • 7. Slide 7 www.edureka.co/persistence-with-hibernate Memory Issue Since hibernate caches the objects will it result in OutOfMemoryException. If that’s the case how to avoid it?
  • 8. Slide 8 www.edureka.co/persistence-with-hibernate Batch Processing with Hibernate Since hibernate caches persistent objects it will end up in out of memory for huge records In order to overcome this hibernate has configurations defined internally By configuring hibernate to insert the rows in batch, one can achieve batch processing in hibernate One can also disable the cache of hibernate during the process hibernate.jdbc.batch_size 50 hibernate.cache.use_second_level_cache false
  • 9. Slide 9 www.edureka.co/persistence-with-hibernate DEMO - Batch Processing With Hibernate
  • 10. Slide 10 www.edureka.co/persistence-with-hibernate Hibernate Caching Caching is used in-order to improve the performance of applications Effectively used by hibernate for caching at object level as well as the query level Improves performance by caching objects which in turn reduces the database hits to a greater extent Techniques used for Caching in hibernate are » First-level Cache » Second-level Cache » Query level cache Database First-level Cache Session Object Second-level Cache Client Hibernate
  • 11. Slide 11 www.edureka.co/persistence-with-hibernate Types of Caching First Level Cache Data are cached at the session level Default cache of hibernate Cached objects exists as long as session is active Mandatory cache used by hibernate across all applications Second Level Cache An optional cache Cache at the session factory level Not enabled by default hence need to enable it explicitly Second Level Cache implementations : » EHCache » Swarm Cache » OS Cache » JBoss Cache Query Level Cache Enabled by hibernate.cache.use_query_cache="true“ Holds the complete query result in cache
  • 12. Slide 12 www.edureka.co/persistence-with-hibernate Hibernate First Level Cache Database Hibernate Session Load Hibernate Session Is Data Available in Session YES NO
  • 13. Slide 13 www.edureka.co/persistence-with-hibernate NO NO Is Data Available in Session Factory Database Hibernate Session Load Hibernate SessionIs Data Available in Session YES Hibernate Second Level Cache Hibernate Session Factory YES
  • 14. Slide 14 www.edureka.co/persistence-with-hibernate DEMO - Optimizing performance using cache
  • 15. Slide 15 www.edureka.co/persistence-with-hibernate Lucene – Full text search An Apache library Full text search capability Developed on java API Query results are returned by relevance Fast, flexible and stable Easy to integrate lucence search functionality to application..
  • 16. Slide 16 www.edureka.co/persistence-with-hibernate How hibernate can perform search on the database with lucene, as lucene can do effective searching on file system Hibernate and Lucene Together
  • 17. Slide 17 www.edureka.co/persistence-with-hibernate Hibernate Search Even though Lucence provides very efficient search capabilities, suffers with several mismatches with domain object models Hibernate Search built on top of the Lucence search engine to address the short comings of lucence in domain object models. Similarly to Hibernate which has been built in top of the SQL databases , Hibernate search built on top of Lucence Hibernate address the short comings of lucence in domain object models with annotations Manages entities when query made to database or as lucence query to index Hibernate + Hibernate Search Database Lucence (Index) Search Request
  • 18. Slide 18 www.edureka.co/persistence-with-hibernate Hibernate Search Dependencies Hibernate search dependencies are provided in the hibernate-search-4.5.2.Final.jar Dependencies can be downloaded from the following locations http://sourceforge.net/projects/hibernate/files/hiberna te-search/ http://repository.jboss.org/nexus/content/groups/publi c-jboss/org/hibernate/ Other required dependencies for hibernate search are available from the following location http://sourceforge.net/projects/hibernate/files/hiberna te4/
  • 19. Slide 19 www.edureka.co/persistence-with-hibernate Hibernate Search Query DSL Easy and efficient API for hibernate search Queries are created via QueryBuilder with the help of SearchFactory QueryBuilder is an interface from the package org.hibernate.search.query.dsl Once created can be easily attached with an entity Queries are created on top of QueryBuilder QueryBuilder queryBuilder = searchFactory.buildQueryBuilder().forEntity(MyEntity.class).get(); builder.range().onField("numberOfPages").above(1000).excludeLimit().createQuery();
  • 21. Slide 21 www.edureka.co/persistence-with-hibernate Validation of Beans Process of verifying data follows pre-defined constraints Validations of beans are basically constraints on object models via annotations Validations can also be defined with custom constraints Since bean validation is a java specification effective APIs can be used for validating the beans Validations of beans has to done on or before persistence of data in-order to maintain data integrity
  • 22. Slide 22 www.edureka.co/persistence-with-hibernate Validation in Applications Validations can be applied at any stage of application Validation can be applied at the web layer ,service layer or at the repository layer Custom constraints can be applied with custom validations Generally validations are preferred more in repository layer to maintain data integrity Web/Presentation Database Service Repository Users Validations
  • 23. Slide 23 www.edureka.co/persistence-with-hibernate Constraints Restrictions/Conditions applied at fields Belongs to javax.validation.constraints Applied on top of fields with annotations like @NotNull, @Min etc. Can be applied at field, class and property AssertFalse The annotated element must be false. AssertFalse.List Defines several @AssertFalse annotations on the same element AssertTrue The annotated element must be true. AssertTrue.List Defines several @AssertTrue annotations on the same element DecimalMax The annotated element must be a number whose value must be lower or equal to the specified maximum. DecimalMax.List Defines several @DecimalMax annotations on the same element DecimalMin The annotated element must be a number whose value must be higher or equal to the specified minimum. Reference : http://docs.oracle.com/javaee/6/api/javax/validation/constraints/package-summary.html
  • 25. Slide 25 www.edureka.co/persistence-with-hibernate Course Topics  Module 1 » Introduction to ORM and Hibernate  Module 2 » Persistence and Session Factory  Module 3 » Association, Mapping & Inheritance  Module 4 » Criteria and Query Language  Module 5 » Transactions ,Filter and Performance  Module 6 » Search and Validation Framework  Module 7 » OGM, NoSQL and Spring  Module 8 » Project
  • 26. Slide 26 LIVE Online Class Class Recording in LMS 24/7 Post Class Support Module Wise Quiz Project Work Verifiable Certificate www.edureka.co/persistence-with-hibernate How it Works?
  • 27. Slide 27 www.edureka.co/persistence-with-hibernate Exclusive On Persistence with Hibernate Course To avail this offer please contact us: US : 1800 275 9730 (toll free) INDIA : +91 88808 62004 Email Us : sales@edureka.co