RaveendraRoodagi
1,512 views
11 slides
Feb 09, 2017
Slide 1 of 11
1
2
3
4
5
6
7
8
9
10
11
About This Presentation
Hibernate framework simplifies the development of java application to interact with the database. Hibernate is an open source, lightweight, ORM (Object Relational Mapping) tool.
An ORM tool simplifies the data creation, data manipulation and data access. It is a programming technique that maps the o...
Hibernate framework simplifies the development of java application to interact with the database. Hibernate is an open source, lightweight, ORM (Object Relational Mapping) tool.
An ORM tool simplifies the data creation, data manipulation and data access. It is a programming technique that maps the object to the data stored in the database.
Size: 1.05 MB
Language: en
Added: Feb 09, 2017
Slides: 11 pages
Slide Content
Introduction to Hibernate Framework www.collaborationtech.co.in Bengaluru INDIA Presentation By Ramananda M.S Rao
Content Content Introduction Object Persistence Hibernate Configuration Persistent Classes Annotations Persistence Life Cycle Components and Model Mapping and Association Entity Inheritance with Hibernate Intermediate Concepts Hibernate Query and Criteria Fetching Strategies Hibernate objects Listeners Project About Us www.collaborationtech.co.in
Introduction Hibernate framework simplifies the development of java application to interact with the database. Hibernate is an open source, lightweight, ORM (Object Relational Mapping) tool . An ORM tool simplifies the data creation, data manipulation and data access. It is a programming technique that maps the object to the data stored in the database . Advantages of Hibernate Framework Open source and Lightweight Fast performance Database Independent query: HQL (Hibernate Query Language) is the object-oriented version of SQL . Automatic table creation: Hibernate framework provides the facility to create the tables of the database automatically. So there is no need to create tables in the database manually . Simplifies complex join: To fetch data form multiple tables is easy in hibernate framework . Hibernate supports Query cache and provide statistics about query and database status. www.collaborationtech.co.in
Example StudentEntity.java package entity; import javax.persistence.Column ; import javax.persistence.Entity ; import javax.persistence.Id ; import javax.persistence.Table ; @Entity @Table(name = "student") public class StudentEntity { @ Id @ Column(name = "ID") private int id; @Column(name = "NAME") private String name; @ Column(name = "DEPARTMENT") private String department; @ Column(name = "COLLEGE") private String college; public int getId () { return id ;} www.collaborationtech.co.in
Example public void setId ( int id) {this.id = id ;} public String getName () {return name ;} public void setName (String name) {this.name = name ;} public String getDepartment () {return department ;} public void setDepartment (String department) { this.department = department ;} public String getCollege () {return college ;} public void setCollege (String college) { this.college = college ; }} www.collaborationtech.co.in
Example package util ; import org.hibernate.Session ; import org.hibernate.SessionFactory ; import org.hibernate.Transaction ; import org.hibernate.boot.registry.StandardServiceRegistryBuilder ; import org.hibernate.cfg.Configuration ; import org.hibernate.service.ServiceRegistry ; import entity.StudentEntity ; public class HibernateUtil { public static void main(String[] args ) { Configuration cf = new Configuration().configure("hibernate.cfg.xml"); StandardServiceRegistryBuilder srb = new StandardServiceRegistryBuilder (); srb.applySettings ( cf.getProperties ()); ServiceRegistry sr = srb.build (); SessionFactory sf = cf.buildSessionFactory ( sr ); Session session = sf.openSession (); www.collaborationtech.co.in