Setting up Hibernate Development Environment

Setup your development

Required Softwares

To Build Hibernate Applications, you need the following:

  1. Java Integrated Development Environment (IDE)
  2. Database Server (MySQL server)
  3. Hibernate JAR files and JDBC Driver

Create a new Java project

New Java Project 
Create a Java Project 
Create a Java project in the workspace or in an external location. 
Project name: hibernate- demol 
Use default location 
O Use an execution engironment JRE: 
Use a project specfic JRE: 
Use default JRE jdkl .8.0_261 and workspace compiler preferences 
Project layout 
use project folder as root for sources and class files 
O Create separate folders for sources and class files 
Working sets 
Add project to working sets 
Working sets: 
JavaSE- 
Configure JREs... 
Configure default...

Create a new folder “lib” for Hibernate jar files

hibernate- demo 
JRE System Library [JavaSE-I .81 
src 
Servers 
New Folder 
Folder 
Create a new folder resource. 
Enter or select the parent folder: 
hibernate- demo 
hibernate-demo 
Servers 
Folder name: 
Advanced

Download Hibernate ORM zip form hibernate.org

Now download JDBC drivers (Connector/J) zip from link below:

https://dev.mysql.com/

https://dev.mysql.com/downloads/connector/j/5.1.html

Connector/J 5.1.49 
Select Operating System: 
Platform Independent 
Recommended Windows Download: 
MySQL Installer 
for Windows 
All MySQL Products. For All Windows Platforms. 
In One Package. 
Starting Kith SS the Mysal_ lÆtaller replaces the ta 
Windows (x86, 32 & 64-bit), MYSQL Installer MSI 
Platform Independent (Architecture 
Independent), Compressed TAR Archive 
(mysql-con nector-java-5.1.49. tar gz) 
Platform Independent (Architecture 
Independent), ZIP Archive 
Looking for the latest GA 
version? 
Go to Download Page > 
5.1.49 
3.2M 
Download 
MD5: e7bc11asssgsbad0eass4S16Sdeabaas I Signature 
5.1.49 
3.5M 
Download

Copy jars from the hibernates lib/required folder to lib folder of the java project

ZIP archive 
Âlantlr-2.7.7.jar 
[Àbyte-buddy 1.10.17.jar 
classmate- I .5.1 jar 
dom4j-2.1 3.jar 
Fastlnfaset- 12.1 5.jar 
hibernate- commons-annotations- 5.1 2.FinaI.jar 
hibernate-core- 5.4.23.FinaI.jar 
istack- commans- runtime-3.O.7 jar 
jandex -2.1 3.FinaI.jar 
lÂjavassist-3.24.O GA.jar 
javax .activatian-api- 1 2.0.jar 
javax .persistence-api-2.2.jar 
l" jaxb-api-23.I Jar 
[À jaxb-runtime-23.I jar 
jbass- lagging-3.4.I .FinaI.jar 
I .I .I .FinaI.jar 
-ex- I Z.jar 
jar

Next copy the connector jar into the lib folder

mysqI-connector-java-5.I .4g.zip\mysqI-connector-java-5.I .49 
mysqI-connector-java-5.I .4g.jar 
mysqI-ccnnectcr-java-i.I.4g-bin.jar 
build.xml 
CHANGES 
COPYING 
README 
README.tx

Now effectively add these jars file to the project class path by right clicking  >  properties  > Libraries > Add JARS.

Properties for hibernate-demo 
Resource 
Builders 
Coverage 
Java Build Path 
Java Code Style 
Java Compiler 
Javadoc Location 
Java Editor 
Project Facets 
Project Natures 
Project References 
Refactoring History 
Run/Debug Settings 
Server 
Task Repository 
Task Tags 
Validation 
WikiText 
Java Build Path 
Source 
Projects 
JARS and class on 
Libraries 
Order and Export 
Module Dependencies 
> JRESys 
JAR Selection 
Choose the archives to be added to the build path: 
settings 
v lib 
ant r- . 
byte-buddy-1.10.17.- 
classmate-I .5.Ijar 
dom4j-2.1 3.jar 
Fastlnfoset-1 2.15jar 
hibernate-commons-a 
hibernate-core-5A.23.FinaIjar 
stack-commons-runtime-3.0.7- 
jandex-2.1 3.FinaI.jar 
javassist-3.24.O- GA jar 
javax.activation-api-1 2.0. 
jar 
Javax .persistence-api-2.2jar 
jaxb-api-23.I jar 
jaxb-runtime-23.I. 
jar 
jboss-Iogging-3A.I .FinaI. 
jar 
jboss-transaction-api_l espec- . . 
mysqI-connector-java-5.I .49-binjar 
Add JARS.. 
Add External JARs... 
Add Variable... 
Add Library... 
Add Class Folder... 
Add External Class Folder... 
Apply and Close 
Apply 
Cancel 
Console X 
No consoles to disolav at this time.

After adding reference to the class path, you will see the “Reference libraries” folder holding all the jars files which we added recently.

Project Explorer X 
JRE System Library [JavaSE-I .81 
src 
v Referenced Libraries 
antlr-2.7.7.jar 
byte-buddy-1110.17. jar 
classmate- 15.1 jar 
dom4j-2.I .3.jar 
Fastlnfoset- I .21 5.jar 
hibernate- commons-annotations-5 
hibernate- core-5.4.23.FinaI.jar 
istack- commons- runtime-3.0.7 jar 
jandex-2.I .3.FinaI.jar 
javassist-3.24.O- GA.jar 
Javax .activation-api- I .2.Djar 
javax persistence-api-2.2.jar 
jaxb-api-2.3.I jar 
jaxb-runtime-2.3.I jar 
jboss- logging-3.4.1 Final.jar 
jboss-transaction-api_l .2_spec- I .1.1 
mysql- connector-java- 5.1.49- bin.jal 
stax-ex- I .8.jar 
txw2-2.3.I jar 
lib 
Servers

Testing  JDBC connection

Create Simple JDBC program

Leave a comment