Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hibernate Setup

I always used Hibernate annotations in my old job, but since all our projects were already set up, I never really learned the mechanism behind it.

Could someone please give me a brief outline of how to set everything up, just to get me started?

I am developing in Java using Maven and Oracle 10g Express Edition. My IDE is Eclipse.

like image 989
mathlovingkitten Avatar asked Sep 06 '26 03:09

mathlovingkitten


2 Answers

I'd recommend starting with the Hibernate tutorial. Basically, you'll need to create a Hibernate configuration file on your classpath (dropping it in src/main/resources works with the default Maven project layout) and then start annotating your data objects. There's a tutorial for Hibernate with XML configuration as well.

like image 179
dml Avatar answered Sep 07 '26 18:09

dml


The (non-Maven) steps to build a Hibernate project in Eclipse would be: Step 1: Add the required JARs to setup Hibernate project Step 2: Add the JARs to the lib folder of your project Step 3: Additionally, I would suggest you to explore the Hibernate directory structure since you are using it for the first time.

If you need more assistance, I wrote a post on my site http://myjavatrainer.com/setup-hibernate-project/

Hope it will be helpful to you.

Maven is build tool for your projects. Maven is a build tool by Apache, it will help to manage the dependencies better. You will have to install Maven separately and set it up. Read its documentation full and get it setup. Instead of creating a normal Java app or a web app in Eclipse, you will be creating a Maven project.

MAKE SURE YOU ADD A JAR FOR DRIVER CONNECTOR for the type of database you are planning to use through Hibernate.

like image 29
Navin Israni Avatar answered Sep 07 '26 18:09

Navin Israni



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!