SlideShare ist ein Scribd-Unternehmen logo
1 von 17
Downloaden Sie, um offline zu lesen
www.edureka.co/persistence-with-hibernate
Leverage Hibernate and Spring Features Together
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 : webinars@edureka.co
Slide 2 www.edureka.co/persistence-with-hibernate
At the end of this webinar, you will be able to understand:
Objectives
 What are Hibernate & Spring Frameworks
 Advantages of Using Spring and Hibernate Together
 Connection Between Hibernate and Spring Frameworks
 Spring Transaction Management Using Hibernate
 Demo
Slide 3 www.edureka.co/persistence-with-hibernate
An Object relational mapping library of java language for Object persistence
and SQL databases
Found in 2001 by Gavin King
Transparent persistence of java objects with relational database
Provides query language in synch with SQL
Open source library
Provides solutions for object relational impedance mismatch problems
Hibernate
Slide 4 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
Persistence 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 5Slide 5Slide 5 www.edureka.co/persistence-with-hibernate
Spring
An open source framework
Enables to build applications using POJO (Plain Old Java Objects)
Handles the complete infrastructure required for application from end to
end
Makes development of JavaEE (Java EnterPrise Applications) easier
Light weight and transparent
Use of IOC Containers
Supports ORM and Transaction Management
Slide 6Slide 6Slide 6 www.edureka.co/persistence-with-hibernate
Spring with Hibernate
An extensive support for ORM frameworks like
Hibernate , JPA
Provides complete infrastructure for any ORM layer used
in the application
 IOC of spring handles the SessionFactory instances of
hibernate
Configurations of hibernate are taken care efficiently by
spring application contexts
Use of hibernate.cfg.xml can be taken care by spring
applicationContext.xml
Declarative Transaction management
Built in support for exception handling
Slide 7Slide 7Slide 7 www.edureka.co/persistence-with-hibernate
Spring supports two different approach for transaction management:
Programmatic Transaction Management
» Transactions are managed by programming codes
» Highly flexible
» Difficult in maintenance
» Spring TransactionTemplate is used for programmatic approach
Declarative Transaction Management
» Transactions are handled declaratively by XML or Annotation
» Will have lesser impact with the code of application
» Extensive support from Spring AOP
» Most widely used
Transaction Management with Spring
Slide 8Slide 8Slide 8 www.edureka.co/persistence-with-hibernate
Spring Aspect Oriented Programming enables to declare transaction
declaratively with Aspect
Aspect scatters across methods, class and even objects
Can be used in xml and annotations
AOP declarative transaction:-
» Transaction-handling advice is created using <tx:advice/> and
pointcut is defined to make transactional advice that matches all
methods
» Advice begins transaction on before calling the method
» On successful execution of method advice commits the
transaction
» On failure advice rolls back
Spring AOP Transaction Management
<tx:advice id="txAdvice"
transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="create"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="createOperation"
expression="execution(*
com.tutorialspoint.StudentJDBCTemplate.create
(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-
ref="createOperation"/>
</aop:config>
Slide 9 www.edureka.co/persistence-with-hibernate
DEMO : Spring Transaction Management Using Hibernate
Slide 10 www.edureka.co/persistence-with-hibernate
Course class
Spring and Hibernate Example
Slide 11 www.edureka.co/persistence-with-hibernate
CourseDAO class
Spring and Hibernate Example (Contd.)
Slide 12 www.edureka.co/persistence-with-hibernate
This is the mapping file which will take care of mapping between your Courses table and Course class
course.hbm.xml
Spring and Hibernate Example (Contd.)
Slide 13 www.edureka.co/persistence-with-hibernate
applicationContext.xml (contd.)
Spring and Hibernate Example (Contd.)
Slide 14 www.edureka.co/persistence-with-hibernate
In the applicationContext.xml file we are declaring lots of bean definition
One is for DataSource definition, one is for Hibernate Session Factory with the mapping resource course.hbm.xml
Then we are creating HibernateTemplate bean setting its sessionFactory property to mysessionfactory
Last is the bean definition of CourseDAO class setting its template property to HibernateTemplate bean
Spring and Hibernate Example (Contd.)
Slide 15 www.edureka.co/persistence-with-hibernate
When you run the TestClass, you will see one row in courses table
Spring and Hibernate Example (Contd.)
Questions
Slide 16 www.edureka.co/persistence-with-hibernate
Slide 17 Course Url

Weitere ähnliche Inhalte

Was ist angesagt?

Java spring framework
Java spring frameworkJava spring framework
Java spring frameworkRajiv Gupta
 
Hibernate complete notes_by_sekhar_sir_javabynatara_j
Hibernate complete notes_by_sekhar_sir_javabynatara_jHibernate complete notes_by_sekhar_sir_javabynatara_j
Hibernate complete notes_by_sekhar_sir_javabynatara_jSatya Johnny
 
Spring Framework - Core
Spring Framework - CoreSpring Framework - Core
Spring Framework - CoreDzmitry Naskou
 
Java Spring framework, Dependency Injection, DI, IoC, Inversion of Control
Java Spring framework, Dependency Injection, DI, IoC, Inversion of ControlJava Spring framework, Dependency Injection, DI, IoC, Inversion of Control
Java Spring framework, Dependency Injection, DI, IoC, Inversion of ControlArjun Thakur
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework tola99
 
Hibernate Interview Questions
Hibernate Interview QuestionsHibernate Interview Questions
Hibernate Interview QuestionsSyed Shahul
 
Tumbleweed intro
Tumbleweed introTumbleweed intro
Tumbleweed introRich Helton
 
Spring core module
Spring core moduleSpring core module
Spring core moduleRaj Tomar
 
Spring IOC advantages and developing spring application sample
Spring IOC advantages and developing spring application sample Spring IOC advantages and developing spring application sample
Spring IOC advantages and developing spring application sample Sunil kumar Mohanty
 
Java & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate FrameworkJava & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate FrameworkMohit Belwal
 

Was ist angesagt? (20)

Java spring framework
Java spring frameworkJava spring framework
Java spring framework
 
Hibernate complete notes_by_sekhar_sir_javabynatara_j
Hibernate complete notes_by_sekhar_sir_javabynatara_jHibernate complete notes_by_sekhar_sir_javabynatara_j
Hibernate complete notes_by_sekhar_sir_javabynatara_j
 
Spring MVC Framework
Spring MVC FrameworkSpring MVC Framework
Spring MVC Framework
 
Spring Framework - Core
Spring Framework - CoreSpring Framework - Core
Spring Framework - Core
 
Spring Framework Rohit
Spring Framework RohitSpring Framework Rohit
Spring Framework Rohit
 
Java Spring framework, Dependency Injection, DI, IoC, Inversion of Control
Java Spring framework, Dependency Injection, DI, IoC, Inversion of ControlJava Spring framework, Dependency Injection, DI, IoC, Inversion of Control
Java Spring framework, Dependency Injection, DI, IoC, Inversion of Control
 
Maven
MavenMaven
Maven
 
Spring User Guide
Spring User GuideSpring User Guide
Spring User Guide
 
Next stop: Spring 4
Next stop: Spring 4Next stop: Spring 4
Next stop: Spring 4
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework
 
Hibernate Interview Questions
Hibernate Interview QuestionsHibernate Interview Questions
Hibernate Interview Questions
 
Tumbleweed intro
Tumbleweed introTumbleweed intro
Tumbleweed intro
 
Spring core module
Spring core moduleSpring core module
Spring core module
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
Hibernate notes
Hibernate notesHibernate notes
Hibernate notes
 
Spring Framework
Spring FrameworkSpring Framework
Spring Framework
 
Spring IOC advantages and developing spring application sample
Spring IOC advantages and developing spring application sample Spring IOC advantages and developing spring application sample
Spring IOC advantages and developing spring application sample
 
Java & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate FrameworkJava & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate Framework
 
Struts notes
Struts notesStruts notes
Struts notes
 
Java Spring Framework
Java Spring FrameworkJava Spring Framework
Java Spring Framework
 

Andere mochten auch

Spring 4 on Java 8 by Juergen Hoeller
Spring 4 on Java 8 by Juergen HoellerSpring 4 on Java 8 by Juergen Hoeller
Spring 4 on Java 8 by Juergen HoellerZeroTurnaround
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applicationshchen1
 
facebook architecture for 600M users
facebook architecture for 600M usersfacebook architecture for 600M users
facebook architecture for 600M usersJongyoon Choi
 
Introduction to Web Architecture
Introduction to Web ArchitectureIntroduction to Web Architecture
Introduction to Web ArchitectureChamnap Chhorn
 
Architecture of a Modern Web App
Architecture of a Modern Web AppArchitecture of a Modern Web App
Architecture of a Modern Web Appscothis
 

Andere mochten auch (8)

Spring 4 on Java 8 by Juergen Hoeller
Spring 4 on Java 8 by Juergen HoellerSpring 4 on Java 8 by Juergen Hoeller
Spring 4 on Java 8 by Juergen Hoeller
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
 
The Modern Software Architect
The Modern Software ArchitectThe Modern Software Architect
The Modern Software Architect
 
Spring & hibernate
Spring & hibernateSpring & hibernate
Spring & hibernate
 
Spring ppt
Spring pptSpring ppt
Spring ppt
 
facebook architecture for 600M users
facebook architecture for 600M usersfacebook architecture for 600M users
facebook architecture for 600M users
 
Introduction to Web Architecture
Introduction to Web ArchitectureIntroduction to Web Architecture
Introduction to Web Architecture
 
Architecture of a Modern Web App
Architecture of a Modern Web AppArchitecture of a Modern Web App
Architecture of a Modern Web App
 

Ähnlich wie Leverage Hibernate and Spring Features Together

Effective Persistence Using ORM With Hibernate
Effective Persistence Using ORM With HibernateEffective Persistence Using ORM With Hibernate
Effective Persistence Using ORM With HibernateEdureka!
 
Hibernate Mapping on the Fly
Hibernate Mapping on the FlyHibernate Mapping on the Fly
Hibernate Mapping on the FlyEdureka!
 
Webinar: Hibernate - the ultimate ORM framework
Webinar: Hibernate - the ultimate ORM frameworkWebinar: Hibernate - the ultimate ORM framework
Webinar: Hibernate - the ultimate ORM frameworkEdureka!
 
Hibernate Interview Questions | Edureka
Hibernate Interview Questions | EdurekaHibernate Interview Questions | Edureka
Hibernate Interview Questions | EdurekaEdureka!
 
Webinar: Persistence with Hibernate - Portal Development & Text Searching wit...
Webinar: Persistence with Hibernate - Portal Development & Text Searching wit...Webinar: Persistence with Hibernate - Portal Development & Text Searching wit...
Webinar: Persistence with Hibernate - Portal Development & Text Searching wit...Edureka!
 
Webinar: Spring Framework - Introduction to Spring WebMVC & Spring with BigData
Webinar: Spring Framework - Introduction to Spring WebMVC & Spring with BigData Webinar: Spring Framework - Introduction to Spring WebMVC & Spring with BigData
Webinar: Spring Framework - Introduction to Spring WebMVC & Spring with BigData Edureka!
 
Stateful patterns in Azure Functions
Stateful patterns in Azure FunctionsStateful patterns in Azure Functions
Stateful patterns in Azure FunctionsMassimo Bonanni
 
Hibernate interview questions
Hibernate interview questionsHibernate interview questions
Hibernate interview questionsvenkata52
 
WinRT and the Web: Keeping Windows Store Apps Alive and Connected
WinRT and the Web: Keeping Windows Store Apps Alive and ConnectedWinRT and the Web: Keeping Windows Store Apps Alive and Connected
WinRT and the Web: Keeping Windows Store Apps Alive and ConnectedJeremy Likness
 
ADVANCED JAVA MODULE I & II.ppt
ADVANCED JAVA MODULE I & II.pptADVANCED JAVA MODULE I & II.ppt
ADVANCED JAVA MODULE I & II.pptrani marri
 
Get Started with JavaScript Frameworks
Get Started with JavaScript FrameworksGet Started with JavaScript Frameworks
Get Started with JavaScript FrameworksChristian Gaetano
 
Streaming to a New Jakarta EE
Streaming to a New Jakarta EEStreaming to a New Jakarta EE
Streaming to a New Jakarta EEJ On The Beach
 
Streaming to a new Jakarta EE
Streaming to a new Jakarta EEStreaming to a new Jakarta EE
Streaming to a new Jakarta EEMarkus Eisele
 
Hibernate reference1
Hibernate reference1Hibernate reference1
Hibernate reference1chandra mouli
 
Spring 1 day program
Spring 1 day programSpring 1 day program
Spring 1 day programMohit Kanwar
 
RichFaces: rich:* component library
RichFaces: rich:* component libraryRichFaces: rich:* component library
RichFaces: rich:* component libraryMax Katz
 
Getting Started with Spring Framework
Getting Started with Spring FrameworkGetting Started with Spring Framework
Getting Started with Spring FrameworkEdureka!
 

Ähnlich wie Leverage Hibernate and Spring Features Together (20)

Effective Persistence Using ORM With Hibernate
Effective Persistence Using ORM With HibernateEffective Persistence Using ORM With Hibernate
Effective Persistence Using ORM With Hibernate
 
Hibernate Mapping on the Fly
Hibernate Mapping on the FlyHibernate Mapping on the Fly
Hibernate Mapping on the Fly
 
Webinar: Hibernate - the ultimate ORM framework
Webinar: Hibernate - the ultimate ORM frameworkWebinar: Hibernate - the ultimate ORM framework
Webinar: Hibernate - the ultimate ORM framework
 
Hibernate Interview Questions | Edureka
Hibernate Interview Questions | EdurekaHibernate Interview Questions | Edureka
Hibernate Interview Questions | Edureka
 
Webinar: Persistence with Hibernate - Portal Development & Text Searching wit...
Webinar: Persistence with Hibernate - Portal Development & Text Searching wit...Webinar: Persistence with Hibernate - Portal Development & Text Searching wit...
Webinar: Persistence with Hibernate - Portal Development & Text Searching wit...
 
The JavaFX Ecosystem
The JavaFX EcosystemThe JavaFX Ecosystem
The JavaFX Ecosystem
 
Webinar: Spring Framework - Introduction to Spring WebMVC & Spring with BigData
Webinar: Spring Framework - Introduction to Spring WebMVC & Spring with BigData Webinar: Spring Framework - Introduction to Spring WebMVC & Spring with BigData
Webinar: Spring Framework - Introduction to Spring WebMVC & Spring with BigData
 
Stateful patterns in Azure Functions
Stateful patterns in Azure FunctionsStateful patterns in Azure Functions
Stateful patterns in Azure Functions
 
Hibernate interview questions
Hibernate interview questionsHibernate interview questions
Hibernate interview questions
 
.net Framework
.net Framework.net Framework
.net Framework
 
The JavaFX Ecosystem
The JavaFX EcosystemThe JavaFX Ecosystem
The JavaFX Ecosystem
 
WinRT and the Web: Keeping Windows Store Apps Alive and Connected
WinRT and the Web: Keeping Windows Store Apps Alive and ConnectedWinRT and the Web: Keeping Windows Store Apps Alive and Connected
WinRT and the Web: Keeping Windows Store Apps Alive and Connected
 
ADVANCED JAVA MODULE I & II.ppt
ADVANCED JAVA MODULE I & II.pptADVANCED JAVA MODULE I & II.ppt
ADVANCED JAVA MODULE I & II.ppt
 
Get Started with JavaScript Frameworks
Get Started with JavaScript FrameworksGet Started with JavaScript Frameworks
Get Started with JavaScript Frameworks
 
Streaming to a New Jakarta EE
Streaming to a New Jakarta EEStreaming to a New Jakarta EE
Streaming to a New Jakarta EE
 
Streaming to a new Jakarta EE
Streaming to a new Jakarta EEStreaming to a new Jakarta EE
Streaming to a new Jakarta EE
 
Hibernate reference1
Hibernate reference1Hibernate reference1
Hibernate reference1
 
Spring 1 day program
Spring 1 day programSpring 1 day program
Spring 1 day program
 
RichFaces: rich:* component library
RichFaces: rich:* component libraryRichFaces: rich:* component library
RichFaces: rich:* component library
 
Getting Started with Spring Framework
Getting Started with Spring FrameworkGetting Started with Spring Framework
Getting Started with Spring Framework
 

Mehr von Edureka!

What to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | EdurekaWhat to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | EdurekaEdureka!
 
Top 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | EdurekaTop 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | EdurekaEdureka!
 
Top 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | EdurekaTop 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | EdurekaEdureka!
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaTableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaEdureka!
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaPython Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaEdureka!
 
Top 5 PMP Certifications | Edureka
Top 5 PMP Certifications | EdurekaTop 5 PMP Certifications | Edureka
Top 5 PMP Certifications | EdurekaEdureka!
 
Top Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | EdurekaTop Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | EdurekaEdureka!
 
Linux Mint Tutorial | Edureka
Linux Mint Tutorial | EdurekaLinux Mint Tutorial | Edureka
Linux Mint Tutorial | EdurekaEdureka!
 
How to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| EdurekaHow to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| EdurekaEdureka!
 
Importance of Digital Marketing | Edureka
Importance of Digital Marketing | EdurekaImportance of Digital Marketing | Edureka
Importance of Digital Marketing | EdurekaEdureka!
 
RPA in 2020 | Edureka
RPA in 2020 | EdurekaRPA in 2020 | Edureka
RPA in 2020 | EdurekaEdureka!
 
Email Notifications in Jenkins | Edureka
Email Notifications in Jenkins | EdurekaEmail Notifications in Jenkins | Edureka
Email Notifications in Jenkins | EdurekaEdureka!
 
EA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | EdurekaEA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | EdurekaEdureka!
 
Cognitive AI Tutorial | Edureka
Cognitive AI Tutorial | EdurekaCognitive AI Tutorial | Edureka
Cognitive AI Tutorial | EdurekaEdureka!
 
AWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | EdurekaAWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | EdurekaEdureka!
 
Blue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | EdurekaBlue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | EdurekaEdureka!
 
Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka Edureka!
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | EdurekaA star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | EdurekaEdureka!
 
Kubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | EdurekaKubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | EdurekaEdureka!
 
Introduction to DevOps | Edureka
Introduction to DevOps | EdurekaIntroduction to DevOps | Edureka
Introduction to DevOps | EdurekaEdureka!
 

Mehr von Edureka! (20)

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

Kürzlich hochgeladen

Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFMichael Gough
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 

Kürzlich hochgeladen (20)

Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDF
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 

Leverage Hibernate and Spring Features Together

  • 1. www.edureka.co/persistence-with-hibernate Leverage Hibernate and Spring Features Together 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 : webinars@edureka.co
  • 2. Slide 2 www.edureka.co/persistence-with-hibernate At the end of this webinar, you will be able to understand: Objectives  What are Hibernate & Spring Frameworks  Advantages of Using Spring and Hibernate Together  Connection Between Hibernate and Spring Frameworks  Spring Transaction Management Using Hibernate  Demo
  • 3. Slide 3 www.edureka.co/persistence-with-hibernate An Object relational mapping library of java language for Object persistence and SQL databases Found in 2001 by Gavin King Transparent persistence of java objects with relational database Provides query language in synch with SQL Open source library Provides solutions for object relational impedance mismatch problems Hibernate
  • 4. Slide 4 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 Persistence 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)
  • 5. Slide 5Slide 5Slide 5 www.edureka.co/persistence-with-hibernate Spring An open source framework Enables to build applications using POJO (Plain Old Java Objects) Handles the complete infrastructure required for application from end to end Makes development of JavaEE (Java EnterPrise Applications) easier Light weight and transparent Use of IOC Containers Supports ORM and Transaction Management
  • 6. Slide 6Slide 6Slide 6 www.edureka.co/persistence-with-hibernate Spring with Hibernate An extensive support for ORM frameworks like Hibernate , JPA Provides complete infrastructure for any ORM layer used in the application  IOC of spring handles the SessionFactory instances of hibernate Configurations of hibernate are taken care efficiently by spring application contexts Use of hibernate.cfg.xml can be taken care by spring applicationContext.xml Declarative Transaction management Built in support for exception handling
  • 7. Slide 7Slide 7Slide 7 www.edureka.co/persistence-with-hibernate Spring supports two different approach for transaction management: Programmatic Transaction Management » Transactions are managed by programming codes » Highly flexible » Difficult in maintenance » Spring TransactionTemplate is used for programmatic approach Declarative Transaction Management » Transactions are handled declaratively by XML or Annotation » Will have lesser impact with the code of application » Extensive support from Spring AOP » Most widely used Transaction Management with Spring
  • 8. Slide 8Slide 8Slide 8 www.edureka.co/persistence-with-hibernate Spring Aspect Oriented Programming enables to declare transaction declaratively with Aspect Aspect scatters across methods, class and even objects Can be used in xml and annotations AOP declarative transaction:- » Transaction-handling advice is created using <tx:advice/> and pointcut is defined to make transactional advice that matches all methods » Advice begins transaction on before calling the method » On successful execution of method advice commits the transaction » On failure advice rolls back Spring AOP Transaction Management <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="create"/> </tx:attributes> </tx:advice> <aop:config> <aop:pointcut id="createOperation" expression="execution(* com.tutorialspoint.StudentJDBCTemplate.create (..))"/> <aop:advisor advice-ref="txAdvice" pointcut- ref="createOperation"/> </aop:config>
  • 9. Slide 9 www.edureka.co/persistence-with-hibernate DEMO : Spring Transaction Management Using Hibernate
  • 10. Slide 10 www.edureka.co/persistence-with-hibernate Course class Spring and Hibernate Example
  • 11. Slide 11 www.edureka.co/persistence-with-hibernate CourseDAO class Spring and Hibernate Example (Contd.)
  • 12. Slide 12 www.edureka.co/persistence-with-hibernate This is the mapping file which will take care of mapping between your Courses table and Course class course.hbm.xml Spring and Hibernate Example (Contd.)
  • 13. Slide 13 www.edureka.co/persistence-with-hibernate applicationContext.xml (contd.) Spring and Hibernate Example (Contd.)
  • 14. Slide 14 www.edureka.co/persistence-with-hibernate In the applicationContext.xml file we are declaring lots of bean definition One is for DataSource definition, one is for Hibernate Session Factory with the mapping resource course.hbm.xml Then we are creating HibernateTemplate bean setting its sessionFactory property to mysessionfactory Last is the bean definition of CourseDAO class setting its template property to HibernateTemplate bean Spring and Hibernate Example (Contd.)
  • 15. Slide 15 www.edureka.co/persistence-with-hibernate When you run the TestClass, you will see one row in courses table Spring and Hibernate Example (Contd.)