SlideShare a Scribd company logo
1 of 32
Download to read offline
Hibernate
reverse engineering
José Luis Muñoz
Jun 17, 2012
Contents
1
1. Hibernate view
2. Create a “new hibernate configuration”
3. Hibernate Reverse Engineering: hibernate.reveng.xml
4. Hibernate code generation configuration
5. Reverse engineering
6. Retrieve objects List
7. Example using Session.get
Hibernate view
2
Choose the correct view
Window > Show View > Hibernate configurations
Hibernate view
3
Click on Hibernate
Hibernate view
4
Click on Open Perspective; this open a dialog box
Create a “new hibernate configuration”
5
Goal:
connect Eclipse with the Data Base using a Hibernate bridge
Eclipse Hibernate
Hibernate.cfg.xml
Data Base
Create a “new hibernate configuration”
6
- Hibernate configuration tab, at the bottom
- Right bottom
- Add configuration
* This name is the same that is going to be used in the code generation configuration
Create a “new hibernate configuration”
7
Project: folder where is located the project
Database connection: Hibernate configured
Configuration file: folder where is located hibernate configuration file (fileName.cfg.xml)
Create a “new hibernate configuration”
8
Options Tab
Database dialect: MySQL
Create a “new hibernate configuration”
9
Classpath Tab
Classpath: you must include hibernate libraries into the path
Create a “new hibernate configuration”
10
Result
Hibernate Reverse Engineering: hibernate.reveng.xml
11
Hibernate Reverse Engineering: hibernate.reveng.xml
12
Goal:
Create a file where is specified the number of tables used to obtained:
- POJOs (plain java objects with attributes and getter/setter methods)
- hbm.xml (mapping files which maps data base fields into class attributes)
Hibernate Reverse Engineering: hibernate.reveng.xml
13
File > New > Hibernate Reverse Engineering File (reveng.xml)
Hibernate Reverse Engineering: hibernate.reveng.xml
14
Parent Folder: must be selected the project folder
Hibernate Reverse Engineering: hibernate.reveng.xml
15
1. Console configuration: choose the configuration created in step 1
2. Refresh (until a data base schema appears at the left box)
3. Click Include: include every table in the data base
3. Click Finish button
* The image above must be obtained as a result of applying the indicated steps
Result
16
* This file specified the tables contained within the data base which must be mapped
17
Goal:
Create a configuration to obtain:
When you run the configuration are created:
- POJOs
- hmb.xml
- Change in hibernate.cfg.xml
- DAO object related to POJOs
Hibernate code generation configuration
Hibernate code generation configuration
18
Run option
Hibernate code generation configuration
19
New Configuration
Console configuration: the same name configured in step 1
Hibernate code generation configuration
20
New Configuration
Revenge.xml: the file generated before
Hibernate code generation configuration
21
New Configuration
General settings: use Java 5 syntax
Exporters: at least one file exporter
22
Goal:
Create a configuration to obtain:
When you run the configuration are created:
- POJOs
- hmb.xml
- Change in hibernate.cfg.xml
- DAO object related to POJOs
Hibernate code generation configuration
Result: hibernate.reveng.xml
* This file match every table contained within the data base
* This file match just employee table contained within the data base
hibernate.reveng.xml
* This file match just employee table contained within the data base.
* The result has effect int the hibernate.cfg.xml changing the number of .hbm files.
Be careful:
hibernate.reveng.xml
* This file match the schema
* NO RESULTS
Be careful !!
26
Goal:
Used the hibernate main files to retrieve and save object without SQL:
- POJOs
- hmb.xml
- DAO object related to POJOs
Retrieve objects List
27
Method used: getEmployeeExample
- First of all we need to configure a Session Factory in order to obtain a Session
Retrieve objects List
28
We obtain a list of objects, though a casting those are converted to Employees
Retrieve objects List
29
We obtain one object and though a casting is converted into an Employee
Example using Session.get
30
Example using Session.get
We obtain one object and though a casting is converted into an Employee
The End
31
joseluis@trustparency.es

More Related Content

Similar to Hibernate reverse engineering

Backbase CXP Manager Setup
Backbase CXP Manager SetupBackbase CXP Manager Setup
Backbase CXP Manager SetupGagan Vishal Mishra
 
Best Practices For Direct Admin Security
Best Practices For Direct Admin SecurityBest Practices For Direct Admin Security
Best Practices For Direct Admin Securitylisa Dsouza
 
GitHub Basics - Derek Bable
GitHub Basics - Derek BableGitHub Basics - Derek Bable
GitHub Basics - Derek Bable"FENG "GEORGE"" YU
 
Django is a high-level Python web framework that enables rapid development of...
Django is a high-level Python web framework that enables rapid development of...Django is a high-level Python web framework that enables rapid development of...
Django is a high-level Python web framework that enables rapid development of...ArijitDutta80
 
Software industrialization
Software industrializationSoftware industrialization
Software industrializationBibek Lama
 
Installation of OpenBiblio on Windows XP using EasyPHP
Installation of OpenBiblio on Windows XP using EasyPHPInstallation of OpenBiblio on Windows XP using EasyPHP
Installation of OpenBiblio on Windows XP using EasyPHPRupesh Kumar
 
Make an Instant Website with Webhooks
Make an Instant Website with WebhooksMake an Instant Website with Webhooks
Make an Instant Website with WebhooksAnne Gentle
 
Automate DBA Tasks With Ansible
Automate DBA Tasks With AnsibleAutomate DBA Tasks With Ansible
Automate DBA Tasks With AnsibleIvica Arsov
 
Tasks of database administrator
Tasks of database administratorTasks of database administrator
Tasks of database administratorAttia Qamar
 
Tasks of dba
Tasks of dbaTasks of dba
Tasks of dbaAttia Qamar
 
Weblogic Console Customization labs
Weblogic Console Customization labsWeblogic Console Customization labs
Weblogic Console Customization labsPeter van Nes
 
2 introduction-php-mvc-cakephp-m2-installation-slides
2 introduction-php-mvc-cakephp-m2-installation-slides2 introduction-php-mvc-cakephp-m2-installation-slides
2 introduction-php-mvc-cakephp-m2-installation-slidesMasterCode.vn
 
CropSyst.ppt
CropSyst.pptCropSyst.ppt
CropSyst.pptBetterMe4
 
Content server installation guide
Content server installation guideContent server installation guide
Content server installation guideNaveed Bashir
 
Play 2.0
Play 2.0Play 2.0
Play 2.0elizhender
 
Getting started-with-zend-framework
Getting started-with-zend-frameworkGetting started-with-zend-framework
Getting started-with-zend-frameworkNilesh Bangar
 

Similar to Hibernate reverse engineering (20)

Backbase CXP Manager Setup
Backbase CXP Manager SetupBackbase CXP Manager Setup
Backbase CXP Manager Setup
 
Best Practices For Direct Admin Security
Best Practices For Direct Admin SecurityBest Practices For Direct Admin Security
Best Practices For Direct Admin Security
 
Hdfs java api
Hdfs java apiHdfs java api
Hdfs java api
 
Final
FinalFinal
Final
 
GitHub Basics - Derek Bable
GitHub Basics - Derek BableGitHub Basics - Derek Bable
GitHub Basics - Derek Bable
 
Django is a high-level Python web framework that enables rapid development of...
Django is a high-level Python web framework that enables rapid development of...Django is a high-level Python web framework that enables rapid development of...
Django is a high-level Python web framework that enables rapid development of...
 
Software industrialization
Software industrializationSoftware industrialization
Software industrialization
 
Installation of OpenBiblio on Windows XP using EasyPHP
Installation of OpenBiblio on Windows XP using EasyPHPInstallation of OpenBiblio on Windows XP using EasyPHP
Installation of OpenBiblio on Windows XP using EasyPHP
 
Make an Instant Website with Webhooks
Make an Instant Website with WebhooksMake an Instant Website with Webhooks
Make an Instant Website with Webhooks
 
Overview of github
Overview of githubOverview of github
Overview of github
 
Tutorial on Node File System
Tutorial on Node File SystemTutorial on Node File System
Tutorial on Node File System
 
Automate DBA Tasks With Ansible
Automate DBA Tasks With AnsibleAutomate DBA Tasks With Ansible
Automate DBA Tasks With Ansible
 
Tasks of database administrator
Tasks of database administratorTasks of database administrator
Tasks of database administrator
 
Tasks of dba
Tasks of dbaTasks of dba
Tasks of dba
 
Weblogic Console Customization labs
Weblogic Console Customization labsWeblogic Console Customization labs
Weblogic Console Customization labs
 
2 introduction-php-mvc-cakephp-m2-installation-slides
2 introduction-php-mvc-cakephp-m2-installation-slides2 introduction-php-mvc-cakephp-m2-installation-slides
2 introduction-php-mvc-cakephp-m2-installation-slides
 
CropSyst.ppt
CropSyst.pptCropSyst.ppt
CropSyst.ppt
 
Content server installation guide
Content server installation guideContent server installation guide
Content server installation guide
 
Play 2.0
Play 2.0Play 2.0
Play 2.0
 
Getting started-with-zend-framework
Getting started-with-zend-frameworkGetting started-with-zend-framework
Getting started-with-zend-framework
 

Recently uploaded

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
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
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
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
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
 
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
 

Recently uploaded (20)

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
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
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
 
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
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
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
 
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
 
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
 

Hibernate reverse engineering