Hibernate Bayu Priyambadha, S.Kom.

Slides:



Advertisements
Similar presentations
TPTP Data Model 1 Database support for TPTP EMF based data models using Elver/Hibernate Guru Nagarajan July 14, 2006.
Advertisements

An Object/Relational Mapping tool Free and open source Simplifies storage of object data in a relational database Removes the need to write and maintain.
Connecting to Databases. relational databases tables and relations accessed using SQL database -specific functionality –transaction processing commit.
Persistence Jim Briggs 1. 2 Database connectivity: JDBC Java Database Connectivity An API for connecting Java programs (applications, applets and servlets)
Rapid Persistence Layer Development with Hibernate Rapid Persistence Layer Development with Hibernate Tyler Mendenhall E-gineering,
Spring, Hibernate and Web Services 13 th September 2014.
.NET Database Technologies: Open-Source Frameworks.
Caching the MDSPlus Data via Hibernate By Ajith M Jose Comp6703 Project Client: Raju Karia Supervisor: Dr. Henry Gardner (Development of “WebScope”)
Hibernate 1. Introduction ORM goal: Take advantage of the things SQL databases do well, without leaving the Java language of objects and classes. ORM.
Fast Track to ColdFusion 9. Getting Started with ColdFusion Understanding Dynamic Web Pages ColdFusion Benchmark Introducing the ColdFusion Language Introducing.
Object Relational Mapping. What does ORM do? Maps Object Model to Relational Model. Resolve impedance mismatch. Resolve mapping of scalar and non-scalar.
Session-02.
Session-01. Hibernate Framework ? Why we use Hibernate ?
Data Persistence and Object-Relational Mapping Slides by James Brucker, used with his permission 1.
Object and object-relational databases 1. Object databases vs. Object-relational databases Object databases Stores complex objects – Data + functions.
Rapid Persistence Layer Development with Hibernate Rapid Persistence Layer Development with Hibernate Tyler Mendenhall E-gineering,
Fresher Technology Specific - JAVA Stream Hibernate Framework
Database System Concepts and Architecture Lecture # 3 22 June 2012 National University of Computer and Emerging Sciences.
LINQ Boot Camp ADO.Net Entity Framework Presenter : Date : Mahesh Moily Nov 26, 2009.
By: Blake Peters.  OODB- Object Oriented Database  An OODB is a database management system in which information is represented in the form of objects.
NHibernate in Action Web Seminar at UMLChina By Pierre Henri Kuaté 2008/08/27
© D. Wong  Indexes  JDBC  JDBC in J2EE (Java 2 Enterprise Edition)
CHAPTER 14 USING RELATIONAL DATABASES TO PROVIDE OBJECT PERSISTENCE (ONLINE) © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database.
Seminar on. Overview Hibernate. What is it? Hibernate. How does it work? Hibernate Tools.
12-CRS-0106 REVISED 8 FEB 2013 CSG2H3 Object Oriented Programming.
Modern Database Techniques Part 1: Object Oriented Databases 3. Different Kinds of OODB.
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 14 Using Relational Databases to Provide Object Persistence (Overview) Modern Database.
Spring Database Access Ojitha Kumanayaka Copyright © Virtusa, 2007.
Hibernate Persistence. What is Persistence Persist data to database or other storage.  In OO world, persistence means persist object to external storage.
Hibernate 3.0. What is Hibernate Hibernate is a free, open source Java package that makes it easy to work with relational databases. Hibernate makes it.
Java Data Persistence Using Hibernate Jack Gardner October 2004.
JPA / HIBERNATE CSCI 6370 Nilayan Bhattacharya Sanket Sable.
DATABASE CONNECTIVITY TO MYSQL. Introduction =>A real life application needs to manipulate data stored in a Database. =>A database is a collection of.
Topic : Hibernate 1 Kaster Nurmukan. An ORM tool The problem fixed by ORM Advantage Hibernate Hibernate Basic –Hibernate sessionFactory –Hibernate Session.
Hibernate Basics. Basics What is persistence? Persistence in Object Oriented Applications? Paradigm Mismatch.  The Problem of Granularity.  The Problem.
Persistence – Iteration 4 Vancouver Bootcamp Aaron Zeckoski
Object storage and object interoperability
Basics of JDBC Session 14.
Java Programming: Advanced Topics 1 Enterprise JavaBeans Chapter 14.
Topic : Hibernate 1 Kaster Nurmukan. An ORM tool Used in data layer of applications Implements JPA.
Introduction – ORM, Helloworld Application
Introduction to ORM Hibernate Hibernate vs JDBC. May 12, 2011 INTRODUCTION TO ORM ORM is a programming technique for converting data between relational.
ORM Basics Repository Pattern, Models, Entity Manager Ivan Yonkov Technical Trainer Software University
CS422 Principles of Database Systems Object-Relational Mapping (ORM) Chengyu Sun California State University, Los Angeles.
CS520 Web Programming Object-Relational Mapping with Hibernate and JPA (I) Chengyu Sun California State University, Los Angeles.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
Hibernate Online Training. Introduction to Hibernate Hibernate is a high-performance Object-Relational persistence and query service which takes care.
Hibernate Java Persistence API. What is Persistence Persistence: The continued or prolonged existence of something. Most Applications Achieve Persistence.
HIBERNATE/Java Overview of technology for Hibernate by محمد حسن کاظمی پوران Master : M.M.Nematollahi.
Database: JDBC Overview
Databases (CS507) CHAPTER 2.
New Technology: Why, What ,How
Don't Know Jack About Object-Relational Mapping?
DEPTT. OF COMP. SC & APPLICATIONS
Chengyu Sun California State University, Los Angeles
Introduction to Persistency
Reflection API, JDBC, Hibernate, RMI
A very brief introduction
Persistence – Iteration 4 Vancouver Bootcamp
Database JDBC Overview CS Programming Languages for Web Applications
Server Concepts Dr. Charles W. Kann.
POOL persistency framework for LHC
Entity Framework By: Casey Griffin.
Software Architecture in Practice
ADO.NET Entity Framework Marcus Tillett
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Database System Concepts and Architecture.
Java Data Persistence Using Hibernate
Introduction of Week 11 Return assignment 9-1 Collect assignment 10-1
Teneo Ganymede Mini Deck
Chengyu Sun California State University, Los Angeles
Presentation transcript:

Hibernate Bayu Priyambadha, S.Kom

What is Hibernate? It is an object-relational mapping (ORM) solution for Java We make our data persistent by storing it in a database Hibernate takes care of this for us

Object-Relational Mapping It is a programming technique for converting object-type data of an object oriented programming language into database tables. Hibernate is used convert object data in JAVA to relational database tables.

Object/Relational Mapping Presentation Layer Business Layer Persistence Layer Database 1. Data management tasks in object-oriented (OO) programming are typically implemented by manipulating objects that are almost always non-scalar values. Such as: user object group Object Model Relational Model

Why Hibernate and not JDBC? JDBC maps Java classes to database tables (and from Java data types to SQL data types) Hibernate automatically generates the SQL queries. Hibernate provides data query and retrieval facilities and can significantly reduce development time otherwise spent with manual data handling in SQL and JDBC. Makes an application portable to all SQL databases.

Hibernate vs. JDBC (an example) JDBC tuple insertion – st.executeUpdate(“INSERT INTO book VALUES(“Harry Potter”,”J.K.Rowling”)); Hibernate tuple insertion – session.save(book1);

Architecture Hibernate sits between your code and the database Maps persistent objects to tables in the database

Hibernate Configuration <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.dialect"> org.hibernate.dialect.MySQLDialect </property> <property name="hibernate.connection.driver_class"> com.mysql.jdbc.Driver <property name="hibernate.connection.url"> jdbc:mysql://localhost:3306/buku <property name="hibernate.connection.username"> root <mapping resource="model/Buku.hbm.xml"/> </session-factory> </hibernate-configuration>

Hibernate Mapping <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <!-- Generated Apr 30, 2012 9:17:25 PM by Hibernate Tools 3.2.1.GA --> <hibernate-mapping> <class name="model.Buku" table="buku" catalog="buku"> <id name="bukuId" type="java.lang.Integer"> <column name="buku_id" /> <generator class="identity" /> </id> <property name="bukuJudul" type="string"> <column name="buku_judul" length="35" /> </property> <property name="bukuPengarang" type="string"> <column name="buku_pengarang" length="50" /> <property name="bukuPubliser" type="string"> <column name="buku_publiser" length="50" /> <property name="bukuTahun" type="string"> <column name="buku_tahun" length="4" /> </class> </hibernate-mapping>

SessionFactory (org.hibernate.SessionFactory) The main contract here is the creation of Session instances. Usually an application has a single SessionFactory instance and threads servicing client requests obtain Session instances from this factory. A factory for Session

Session (org.hibernate.Session) The main runtime interface between a Java application and Hibernate. This is the central API class abstracting the notion of a persistence service. A short-lived object Representing a conversation between the application and the database Wraps a JDBC connection Factory for Transaction

Thank You....