SlideShare a Scribd company logo
1 of 17
JAVA-Hibernate(ORM
Implementation Tool)
By
Javawithease
Intro to HibernateIntro to Hibernate
 "Hibernate is an object/relational mapping tool for Java
environments. The term object/relational mapping (ORM)
refers to the technique of mapping a data representation
from an object model to a relational data model with a
SQL-based schema." -- Preface Hibernate
Documentation
 Hibernate supports many different relational databases.
 Many other open source tools use Hibernate as their
persistence layer.
 Hibernate includes tools to make O/R persistence an
integrated part of the build process.
Intro to Hibernate: ObjectivesIntro to Hibernate: Objectives
This presentation will consist of some
background information on Hibernate and
some complete examples that show the
basic functionality of Hibernate.
Obviously there is more than one way to use
Hibernate.
Hibernate BasicsHibernate Basics
Hibernate BasicsHibernate Basics
SessionFactory
A threadsafe (immutable) cache of
compiled mappings for a single
database.
A factory for Session.
Expensive to create.
Hibernate BasicsHibernate Basics
Session
A single-threaded, short-lived object
representing a conversation between
the application and the persistent
store.
Wraps a JDBC connection.
Factory for Transaction.
Holds a mandatory (first-level) cache
of persistent objects, used when
navigating the object graph or looking
up objects by identifier.
Hibernate BasicsHibernate Basics
Persistent Objects and
Collections
Short-lived, single threaded objects
containing persistent state and
business function.
These might be ordinary
JavaBeans/POJOs, the only special
thing about them is that they are
currently associated with (exactly one)
Session.
As soon as the Session is closed, they
will be detached and free to use in any
application layer (e.g. directly as data
transfer objects to and from
presentation).
Hibernate BasicsHibernate Basics
Transient Objects and
Collections
Instances of persistent classes that
are not currently associated with a
Session.
They may have been instantiated by
the application and not (yet) persisted
or they may have been instantiated by
a closed Session.
Hibernate BasicsHibernate Basics
Transaction
(Optional) A single-threaded, short-
lived object used by the application to
specify atomic units of work.
Abstracts application from underlying
JDBC, JTA or CORBA transaction.
Multiple transactions per Session.
Hibernate BasicsHibernate Basics
ConnectionProvider
(Optional) A factory for (and pool
of) JDBC connections. Abstracts
application from underlying
Datasource or DriverManager.
Not exposed to application, but
can be extended/implemented by
the developer.
TransactionFactory
(Optional) A factory for
Transaction instances. Not
exposed to the application, but
can be extended/implemented by
the developer.
Hibernate ToolsHibernate Tools
The Hibernate Mapping File
Database Schema Generation
net.sf.hibernate.tool.hbm2ddl.SchemaExportTask
net.sf.hibernate.tool.hbm2ddl.SchemaUpdateTask
Best Practices suggest having one file per entity.
Java Code Generation
net.sf.hibernate.tool.hbm2java.Hbm2JavaTask
Hibernate ToolsHibernate Tools
The Hibernate Mapping File Best Practices suggest having one file per entity.
Database Schema Reverse Engineering
(Bottom Up development)
Middlegen
Object Driven Design
(Top Down development)
AndroMDA
XMI -> *.hbm.xml
XDoclet can also be used to
directly embed the mapping file
information in the source code.
Hibernate ConfigurationHibernate Configuration
hibernate.properties
hibernate.dialect=net.sf.hibernate.dialect.HSQLDialect
hibernate.connection.driver_class=org.hsqldb.jdbcDriver
## in Ant you can get away with a relative path
## however using this through Eclipse requires an explicit path
hibernate.connection.url=
jdbc:hsqldb:c:/workspace/HibernateNotebook/data/music
hibernate.connection.username=sa
hibernate.connection.password=
Hibernate ConfigurationHibernate Configuration
Currently supported Dialects
DB2390Dialect DB2400Dialect DB2Dialect FirebirdDialect
FrontBaseDialect GenericDialect HSQLDialect
Informix9Dialect InformixDialect IngresDialect
InterbaseDialect MckoiDialect MySQLDialect
NoArgSQLFunction Oracle9Dialect OracleDialect
PointbaseDialect PostgreSQLDialect ProgressDialect
SAPDBDialect SQLServerDialect StandardSQLFunction
Sybase11_9_2Dialect SybaseAnywhereDialect SybaseDialect
Or you can choose to extend the Abstract Dialect object to add support to
whatever database you are using. A Dialect “Represents a dialect of SQL
implemented by a particular RDBMS. Subclasses implement Hibernate
compatibility with different systems.” -- Hibernate Documentation
Hibernate Mapping FilesHibernate Mapping Files
*.hbm.xml*.hbm.xml
Problem Statement:
Create a database system to store electronic music files from various
sources. We need to keep track of individual tracks, who performed them,
and comments for each track.
This example is taken primarily from the example presented in “Hibernate:
A Developer's Notebook” by James Elliot.
Any similarities are intentional; any differences are either mistakes or
modifications made for clarification.
Assumption: We are looking only at data objects and their relationships no
"business" logic will be considered.
Hibernate Mapping FilesHibernate Mapping Files
Track
id: int
title: String
filePath: String
playTime: Date
added: Date
volume: short
comments: Set
artists: Set
Artist
id: int
name: String
tracks: Set
This is a Many-To-Many relationship:
An artist can have many tracks and a track can
be created by several artists.
String: comment This is a one to many relationship: a Track has
multiple comments. (Composite object)
Hibernate Mapping File DemoHibernate Mapping File Demo
 Mapping file structure
 Schema Generation
 Code Generation
 Populate the database with records
 Query the records
 Modify existing records
 Delete Records

More Related Content

What's hot

Entity Framework Overview
Entity Framework OverviewEntity Framework Overview
Entity Framework OverviewEyal Vardi
 
NHibernate (The ORM For .NET Platform)
NHibernate (The ORM For .NET Platform)NHibernate (The ORM For .NET Platform)
NHibernate (The ORM For .NET Platform)Samnang Chhun
 
Free Hibernate Tutorial | VirtualNuggets
Free Hibernate Tutorial  | VirtualNuggetsFree Hibernate Tutorial  | VirtualNuggets
Free Hibernate Tutorial | VirtualNuggetsVirtual Nuggets
 
Entity Framework - Entity Data Model (edm)
Entity Framework - Entity Data Model (edm)Entity Framework - Entity Data Model (edm)
Entity Framework - Entity Data Model (edm)Eyal Vardi
 
ADO.NET Entity Framework
ADO.NET Entity FrameworkADO.NET Entity Framework
ADO.NET Entity FrameworkDoncho Minkov
 
Entity Framework - Queries
Entity Framework -  QueriesEntity Framework -  Queries
Entity Framework - QueriesEyal Vardi
 
Learn Entity Framework in a day with Code First, Model First and Database First
Learn Entity Framework in a day with Code First, Model First and Database FirstLearn Entity Framework in a day with Code First, Model First and Database First
Learn Entity Framework in a day with Code First, Model First and Database FirstJibran Rasheed Khan
 
Entity Framework
Entity FrameworkEntity Framework
Entity Frameworkvrluckyin
 
Hibernate Interview Questions | Edureka
Hibernate Interview Questions | EdurekaHibernate Interview Questions | Edureka
Hibernate Interview Questions | EdurekaEdureka!
 
Entity Framework Database and Code First
Entity Framework Database and Code FirstEntity Framework Database and Code First
Entity Framework Database and Code FirstJames Johnson
 
Introduction To Hibernate
Introduction To HibernateIntroduction To Hibernate
Introduction To Hibernateashishkulkarni
 
Introducing Entity Framework 4.0
Introducing Entity Framework 4.0Introducing Entity Framework 4.0
Introducing Entity Framework 4.0Bishoy Demian
 
Entity Framework v2 Best Practices
Entity Framework v2 Best PracticesEntity Framework v2 Best Practices
Entity Framework v2 Best PracticesAndri Yadi
 
Entity Framework - Object Services
Entity Framework -  Object ServicesEntity Framework -  Object Services
Entity Framework - Object ServicesEyal Vardi
 
Entity framework code first
Entity framework code firstEntity framework code first
Entity framework code firstConfiz
 
Encompassing Information Integration
Encompassing Information IntegrationEncompassing Information Integration
Encompassing Information Integrationnguyenfilip
 
Entity framework 4.0
Entity framework 4.0Entity framework 4.0
Entity framework 4.0Abhishek Sur
 
Building High Scalability Apps With Terracotta
Building High Scalability Apps With TerracottaBuilding High Scalability Apps With Terracotta
Building High Scalability Apps With TerracottaDavid Reines
 
Optimizing Application Architecture (.NET/Java topics)
Optimizing Application Architecture (.NET/Java topics)Optimizing Application Architecture (.NET/Java topics)
Optimizing Application Architecture (.NET/Java topics)Ravi Okade
 

What's hot (20)

Entity Framework Overview
Entity Framework OverviewEntity Framework Overview
Entity Framework Overview
 
NHibernate (The ORM For .NET Platform)
NHibernate (The ORM For .NET Platform)NHibernate (The ORM For .NET Platform)
NHibernate (The ORM For .NET Platform)
 
Free Hibernate Tutorial | VirtualNuggets
Free Hibernate Tutorial  | VirtualNuggetsFree Hibernate Tutorial  | VirtualNuggets
Free Hibernate Tutorial | VirtualNuggets
 
Entity Framework - Entity Data Model (edm)
Entity Framework - Entity Data Model (edm)Entity Framework - Entity Data Model (edm)
Entity Framework - Entity Data Model (edm)
 
ADO.NET Entity Framework
ADO.NET Entity FrameworkADO.NET Entity Framework
ADO.NET Entity Framework
 
Entity Framework - Queries
Entity Framework -  QueriesEntity Framework -  Queries
Entity Framework - Queries
 
Learn Entity Framework in a day with Code First, Model First and Database First
Learn Entity Framework in a day with Code First, Model First and Database FirstLearn Entity Framework in a day with Code First, Model First and Database First
Learn Entity Framework in a day with Code First, Model First and Database First
 
Entity Framework
Entity FrameworkEntity Framework
Entity Framework
 
Hibernate Interview Questions | Edureka
Hibernate Interview Questions | EdurekaHibernate Interview Questions | Edureka
Hibernate Interview Questions | Edureka
 
Entity Framework Database and Code First
Entity Framework Database and Code FirstEntity Framework Database and Code First
Entity Framework Database and Code First
 
Introduction To Hibernate
Introduction To HibernateIntroduction To Hibernate
Introduction To Hibernate
 
Introducing Entity Framework 4.0
Introducing Entity Framework 4.0Introducing Entity Framework 4.0
Introducing Entity Framework 4.0
 
Entity Framework v2 Best Practices
Entity Framework v2 Best PracticesEntity Framework v2 Best Practices
Entity Framework v2 Best Practices
 
Entity Framework - Object Services
Entity Framework -  Object ServicesEntity Framework -  Object Services
Entity Framework - Object Services
 
Entity framework code first
Entity framework code firstEntity framework code first
Entity framework code first
 
Encompassing Information Integration
Encompassing Information IntegrationEncompassing Information Integration
Encompassing Information Integration
 
Entity framework 4.0
Entity framework 4.0Entity framework 4.0
Entity framework 4.0
 
Building High Scalability Apps With Terracotta
Building High Scalability Apps With TerracottaBuilding High Scalability Apps With Terracotta
Building High Scalability Apps With Terracotta
 
Optimizing Application Architecture (.NET/Java topics)
Optimizing Application Architecture (.NET/Java topics)Optimizing Application Architecture (.NET/Java topics)
Optimizing Application Architecture (.NET/Java topics)
 
Spring survey
Spring surveySpring survey
Spring survey
 

Viewers also liked

Buscar una ruta amb Google Maps - Opció 1
Buscar una ruta amb Google Maps - Opció 1Buscar una ruta amb Google Maps - Opció 1
Buscar una ruta amb Google Maps - Opció 1IOCacp
 
Invitación Conferencia IMEI Expo Seguridad 2017
Invitación Conferencia IMEI Expo Seguridad 2017Invitación Conferencia IMEI Expo Seguridad 2017
Invitación Conferencia IMEI Expo Seguridad 2017Antonio Pérez
 
Textron Aviation.pptx
Textron Aviation.pptxTextron Aviation.pptx
Textron Aviation.pptxEmily Haskins
 
Schneider_Newsletter_Dec 2014_Final-1
Schneider_Newsletter_Dec 2014_Final-1Schneider_Newsletter_Dec 2014_Final-1
Schneider_Newsletter_Dec 2014_Final-1Nidhi Vats
 
Lavori in corso!
Lavori in corso!Lavori in corso!
Lavori in corso!elenavio
 
Presentation Roy's Maritime (2)
Presentation Roy's Maritime (2)Presentation Roy's Maritime (2)
Presentation Roy's Maritime (2)Thuy Linh PHAM
 
Dolakha hrrp coordination team meeting 160302
Dolakha hrrp coordination team meeting 160302Dolakha hrrp coordination team meeting 160302
Dolakha hrrp coordination team meeting 160302Rup Kumar BK
 
occc_viewbook_2015_WEB
occc_viewbook_2015_WEBoccc_viewbook_2015_WEB
occc_viewbook_2015_WEBMarc Tolen
 

Viewers also liked (12)

Buscar una ruta amb Google Maps - Opció 1
Buscar una ruta amb Google Maps - Opció 1Buscar una ruta amb Google Maps - Opció 1
Buscar una ruta amb Google Maps - Opció 1
 
Invitación Conferencia IMEI Expo Seguridad 2017
Invitación Conferencia IMEI Expo Seguridad 2017Invitación Conferencia IMEI Expo Seguridad 2017
Invitación Conferencia IMEI Expo Seguridad 2017
 
Verificador catastral
Verificador catastralVerificador catastral
Verificador catastral
 
Datasheet
DatasheetDatasheet
Datasheet
 
Textron Aviation.pptx
Textron Aviation.pptxTextron Aviation.pptx
Textron Aviation.pptx
 
Schneider_Newsletter_Dec 2014_Final-1
Schneider_Newsletter_Dec 2014_Final-1Schneider_Newsletter_Dec 2014_Final-1
Schneider_Newsletter_Dec 2014_Final-1
 
Presentation1
Presentation1Presentation1
Presentation1
 
Lavori in corso!
Lavori in corso!Lavori in corso!
Lavori in corso!
 
Presentation Roy's Maritime (2)
Presentation Roy's Maritime (2)Presentation Roy's Maritime (2)
Presentation Roy's Maritime (2)
 
RacingReflection2014
RacingReflection2014RacingReflection2014
RacingReflection2014
 
Dolakha hrrp coordination team meeting 160302
Dolakha hrrp coordination team meeting 160302Dolakha hrrp coordination team meeting 160302
Dolakha hrrp coordination team meeting 160302
 
occc_viewbook_2015_WEB
occc_viewbook_2015_WEBoccc_viewbook_2015_WEB
occc_viewbook_2015_WEB
 

Similar to Java hibernate orm implementation tool

Hibernate Developer Reference
Hibernate Developer ReferenceHibernate Developer Reference
Hibernate Developer ReferenceMuthuselvam RS
 
Hibernate Interview Questions
Hibernate Interview QuestionsHibernate Interview Questions
Hibernate Interview QuestionsMayank Kumar
 
Java Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and ExampleJava Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and Examplekamal kotecha
 
Hibernate complete Training
Hibernate complete TrainingHibernate complete Training
Hibernate complete Trainingsourabh aggarwal
 
Hibernate Interview Questions and Answers
Hibernate Interview Questions and AnswersHibernate Interview Questions and Answers
Hibernate Interview Questions and AnswersAnuragMourya8
 
Hibernate interview questions
Hibernate interview questionsHibernate interview questions
Hibernate interview questionsvenkata52
 
Hibernate tutorial for beginners
Hibernate tutorial for beginnersHibernate tutorial for beginners
Hibernate tutorial for beginnersRahul Jain
 
Hibernate Interview Questions
Hibernate Interview QuestionsHibernate Interview Questions
Hibernate Interview QuestionsSyed Shahul
 
Hibernate reference1
Hibernate reference1Hibernate reference1
Hibernate reference1chandra mouli
 

Similar to Java hibernate orm implementation tool (20)

Introduction to Hibernate
Introduction to HibernateIntroduction to Hibernate
Introduction to Hibernate
 
What is hibernate?
What is hibernate?What is hibernate?
What is hibernate?
 
Hibernate in Action
Hibernate in ActionHibernate in Action
Hibernate in Action
 
What is hibernate?
What is hibernate?What is hibernate?
What is hibernate?
 
Hibernate 3
Hibernate 3Hibernate 3
Hibernate 3
 
Hibernate Developer Reference
Hibernate Developer ReferenceHibernate Developer Reference
Hibernate Developer Reference
 
Hibernate Interview Questions
Hibernate Interview QuestionsHibernate Interview Questions
Hibernate Interview Questions
 
TY.BSc.IT Java QB U6
TY.BSc.IT Java QB U6TY.BSc.IT Java QB U6
TY.BSc.IT Java QB U6
 
Hibernate
HibernateHibernate
Hibernate
 
Java Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and ExampleJava Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and Example
 
Hibernate complete Training
Hibernate complete TrainingHibernate complete Training
Hibernate complete Training
 
Hibernate.pdf
Hibernate.pdfHibernate.pdf
Hibernate.pdf
 
Hibernate Interview Questions and Answers
Hibernate Interview Questions and AnswersHibernate Interview Questions and Answers
Hibernate Interview Questions and Answers
 
Hibernate 18052012
Hibernate 18052012Hibernate 18052012
Hibernate 18052012
 
Hibernate tutorial
Hibernate tutorialHibernate tutorial
Hibernate tutorial
 
Hibernate interview questions
Hibernate interview questionsHibernate interview questions
Hibernate interview questions
 
Hibernate training-topics
Hibernate training-topicsHibernate training-topics
Hibernate training-topics
 
Hibernate tutorial for beginners
Hibernate tutorial for beginnersHibernate tutorial for beginners
Hibernate tutorial for beginners
 
Hibernate Interview Questions
Hibernate Interview QuestionsHibernate Interview Questions
Hibernate Interview Questions
 
Hibernate reference1
Hibernate reference1Hibernate reference1
Hibernate reference1
 

Recently uploaded

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 

Recently uploaded (20)

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 

Java hibernate orm implementation tool

  • 2. Intro to HibernateIntro to Hibernate  "Hibernate is an object/relational mapping tool for Java environments. The term object/relational mapping (ORM) refers to the technique of mapping a data representation from an object model to a relational data model with a SQL-based schema." -- Preface Hibernate Documentation  Hibernate supports many different relational databases.  Many other open source tools use Hibernate as their persistence layer.  Hibernate includes tools to make O/R persistence an integrated part of the build process.
  • 3. Intro to Hibernate: ObjectivesIntro to Hibernate: Objectives This presentation will consist of some background information on Hibernate and some complete examples that show the basic functionality of Hibernate. Obviously there is more than one way to use Hibernate.
  • 5. Hibernate BasicsHibernate Basics SessionFactory A threadsafe (immutable) cache of compiled mappings for a single database. A factory for Session. Expensive to create.
  • 6. Hibernate BasicsHibernate Basics Session A single-threaded, short-lived object representing a conversation between the application and the persistent store. Wraps a JDBC connection. Factory for Transaction. Holds a mandatory (first-level) cache of persistent objects, used when navigating the object graph or looking up objects by identifier.
  • 7. Hibernate BasicsHibernate Basics Persistent Objects and Collections Short-lived, single threaded objects containing persistent state and business function. These might be ordinary JavaBeans/POJOs, the only special thing about them is that they are currently associated with (exactly one) Session. As soon as the Session is closed, they will be detached and free to use in any application layer (e.g. directly as data transfer objects to and from presentation).
  • 8. Hibernate BasicsHibernate Basics Transient Objects and Collections Instances of persistent classes that are not currently associated with a Session. They may have been instantiated by the application and not (yet) persisted or they may have been instantiated by a closed Session.
  • 9. Hibernate BasicsHibernate Basics Transaction (Optional) A single-threaded, short- lived object used by the application to specify atomic units of work. Abstracts application from underlying JDBC, JTA or CORBA transaction. Multiple transactions per Session.
  • 10. Hibernate BasicsHibernate Basics ConnectionProvider (Optional) A factory for (and pool of) JDBC connections. Abstracts application from underlying Datasource or DriverManager. Not exposed to application, but can be extended/implemented by the developer. TransactionFactory (Optional) A factory for Transaction instances. Not exposed to the application, but can be extended/implemented by the developer.
  • 11. Hibernate ToolsHibernate Tools The Hibernate Mapping File Database Schema Generation net.sf.hibernate.tool.hbm2ddl.SchemaExportTask net.sf.hibernate.tool.hbm2ddl.SchemaUpdateTask Best Practices suggest having one file per entity. Java Code Generation net.sf.hibernate.tool.hbm2java.Hbm2JavaTask
  • 12. Hibernate ToolsHibernate Tools The Hibernate Mapping File Best Practices suggest having one file per entity. Database Schema Reverse Engineering (Bottom Up development) Middlegen Object Driven Design (Top Down development) AndroMDA XMI -> *.hbm.xml XDoclet can also be used to directly embed the mapping file information in the source code.
  • 13. Hibernate ConfigurationHibernate Configuration hibernate.properties hibernate.dialect=net.sf.hibernate.dialect.HSQLDialect hibernate.connection.driver_class=org.hsqldb.jdbcDriver ## in Ant you can get away with a relative path ## however using this through Eclipse requires an explicit path hibernate.connection.url= jdbc:hsqldb:c:/workspace/HibernateNotebook/data/music hibernate.connection.username=sa hibernate.connection.password=
  • 14. Hibernate ConfigurationHibernate Configuration Currently supported Dialects DB2390Dialect DB2400Dialect DB2Dialect FirebirdDialect FrontBaseDialect GenericDialect HSQLDialect Informix9Dialect InformixDialect IngresDialect InterbaseDialect MckoiDialect MySQLDialect NoArgSQLFunction Oracle9Dialect OracleDialect PointbaseDialect PostgreSQLDialect ProgressDialect SAPDBDialect SQLServerDialect StandardSQLFunction Sybase11_9_2Dialect SybaseAnywhereDialect SybaseDialect Or you can choose to extend the Abstract Dialect object to add support to whatever database you are using. A Dialect “Represents a dialect of SQL implemented by a particular RDBMS. Subclasses implement Hibernate compatibility with different systems.” -- Hibernate Documentation
  • 15. Hibernate Mapping FilesHibernate Mapping Files *.hbm.xml*.hbm.xml Problem Statement: Create a database system to store electronic music files from various sources. We need to keep track of individual tracks, who performed them, and comments for each track. This example is taken primarily from the example presented in “Hibernate: A Developer's Notebook” by James Elliot. Any similarities are intentional; any differences are either mistakes or modifications made for clarification. Assumption: We are looking only at data objects and their relationships no "business" logic will be considered.
  • 16. Hibernate Mapping FilesHibernate Mapping Files Track id: int title: String filePath: String playTime: Date added: Date volume: short comments: Set artists: Set Artist id: int name: String tracks: Set This is a Many-To-Many relationship: An artist can have many tracks and a track can be created by several artists. String: comment This is a one to many relationship: a Track has multiple comments. (Composite object)
  • 17. Hibernate Mapping File DemoHibernate Mapping File Demo  Mapping file structure  Schema Generation  Code Generation  Populate the database with records  Query the records  Modify existing records  Delete Records