Hibernate-1x2

Hibernate-1x2 - Hibernate by Example Eitan Suez, UptoData...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
Hibernate by Example Eitan Suez, UptoData Inc About the Speaker Java Programmer http://u2d.com/ Weblog on http://java.net/ NFJS Speaker
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Goals To get you up and running with Hibernate To Learn O/R Mapping with Hibernate, in a hands-on, iterative manner To get a good, first-hand feel of this framework Motivation My experience using Hibernate has convinced me that it has many gems, is useful in many circumstances, and is worth studying The belief that the best way to learn something is by doing it actively
Background image of page 2
Style Do { Model a class of objects Construct database mapping Export or update database schema Write Hibernate code to save sample data to database Write Hibernate code to query database } until we've covered most of the mapping features of Hibernate Disclaimer There is a lot to this framework, cannot cover every aspect in a simple 1-2 hr course Emphasis on constructing a meaningful sample application at the expense of completeness: I will not be covering every minute detail of the framework
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Agenda 1.Project Background 2.Mapping 3.The API 4.Session Usage Strategies 5.Performance 6.Batch Processing 7.UserType's 8.Annotations 9.Tools, Hibernate 3 features What is Hibernate? An Object/Relational Mapping (O/R M) API for Java Open Source (LGPL) Today a part of RedHat Principal author: Gavin King Other Major Figure: Christian Bauer Almost a defacto standard O/R M for Java Current version 3.1 (3.2 almost final)
Background image of page 4
Once upon a time. . 1. A single mechanism for specifying Object- Database Mapping: hibernate .hbm.xml mapping files 2. One Specific Runtime API Hibernate Today Multiple Projects Compliance with new EJB3 Persistence Standards Supports both xml mapping and Java 5 Annotations Supports both the Hibernate API and the EJB3 Persistence API
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1. Mapping The process of specifying the bindings between an object model and a database schema Principal mechanism is via XML mapping files Defacto file name extension: is .hbm.xml Multiple ways to set this up: a single file, one file per class. Best practice is is to use one file per class, with each file placed next to its corresponding class file in the package hierarchy, and loaded as a resource Mapping Entities Basic Properties Components Associations Many-To-One One-To-Many Many-To-Many Inheritance Mapping Modeling with Interfaces
Background image of page 6
Model-Centric Write Model Classes and Mappings; Generate Database Schema Reverse Engineering Tools available to do the reverse Coding a Sample Application (live)
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
The Model Types: Entities vs Values Analogous to by-reference vs by-value semantics in programming languages Just as primitives (int's) are passed by value as parameters to methods (values are copied), by-value semantics in the database implies the same thing: value will map to a table column and will not be shared or referenced by other entities Entities on the other hand are the reverse, they are shared (e.g. a many to one scenario)
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 04/23/2010.

Page1 / 32

Hibernate-1x2 - Hibernate by Example Eitan Suez, UptoData...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online