Download presentation
Presentation is loading. Please wait.
Published byClifford Owen Modified over 9 years ago
1
H IBERNATE
2
N ETBEANS -D ATABASE -H IBERNATE D OWNLOADS 1. Download Jdk and install 2. Download Java IDE ( Netbeans,Eclipse) 3. Setup a Database (Postgresql, MySQL,Oracle..) 4. Download hibernate files from http://sourceforge.net/projects/hibernate/files/ hibernate Core hibernate annotations
3
H OW TO CONFIGURE ? Netbeans Database Hibernate MySQL User Library hibernate.cfg.xml
4
U SER LIBRARY User library is a folder for required hibernate jar files In your IDE: create a Hibernate "library" add JARs to the library better than copying JAR files to your project Required Libraries antlr-2.7.6.jar cglib.jar commons-collections.jar dom4j.jar ejb-3-persistence hibernate-annotation.jar hibernate-commons- annotation.jar hibernate3.jar javassist-3.9.0.GA.jar jta-1.1.jar log4j.jar slf4j-api-1.5.8.jar slf4j-log4j12.jar // and database connector mysql-connector-java-5.1.13- bin.jar
5
C REATE A H IBERNATE L IBRARY IN E CLIPSE 1. Tools -> Libraries 3. Click "Add Library..." and select "User Library", Next> 4. Create a new user library named "Hibernate" 5. Add Jar files
6
HIBERNATE. CFG. XML hibernate.cfg.xml Customize, (thread) Make comment and 2 mapping lines
7
EXAMPLE Example 1: Employee Example Setup Eclipse-Database-Hibernate Create a table out of a class Insert an object as a record Example 2 : Employee Example Other annotations Generate primary key
8
E XAMPLE Example 3 : how to split one class to two tables Example 4 : two classes one table Example 5 : compound primary key Example 6 : inheritance mapping Example 7: one to one mapping Example 8: one to many Example 9: many to many
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.