aspose file tools*
The moose likes Object Relational Mapping and the fly likes How to start hibernating? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "How to start hibernating?" Watch "How to start hibernating?" New topic
Author

How to start hibernating?

chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 800

hi everybody, I want to learn hibernate, but I cant buy a book online because I don't have any credit card, so I decided to start it online, I found examples in roseindia.com, the examples are nice but they dint give hibernating in a web application. I don't know where to place the .xml files. Can anyone tell me the structure, and I am not using any frame work. Simply jsp's, servlets and beans. I know only MVC architecture. I am using MySql database. Now I want to learn hibernate.

And please tell me what are the minimum jar files and where to place them, I usually place them in the lib folder of the web application.

All I know till now is jsps, servlets, beans and models, now I want to replace the models with hibernate concepts. Can anyone tell me the directory structure.

Thank you all in advance. Have a good day.


Love all, trust a few, do wrong to none.
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 800

Hi all of you, is there anyone who can help me fix this problem.
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 800

Is there anyone who is interested in helping me fix this problem?
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 800

Hi friends, I have written a POJO, its under WEB-INF folder. After making a search in web I found this answer "place hbm.xml files in classes folder". Is this right?

Then where should I place the cfg.xml file? What are the minimum jars I have to use to run my application using hibernate?

Please is there anyone who can help me?
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 800

Hi guys, I placed .cgf.xml file and hbm.xml files under src folder in eclipse IDE. I am using these jar files

antlr-2.7.6rc1.jar
asm.jar
asm-attrs-2.2.jar
c3p0-0.9.0.jar
commons-logging.jar
commons-validator.jar
dom4j-1.6.1.jar
hibernate3.jar
jta.jar
log4j-1.2.14.jar
mysql-connector-java-5.1.12-bin.jar

Now what is the procedure?

I am using jsp to send request, a servlet will receive the request and extracts the values from the request and send the values to a model for validation. If the details are valid then it sets the bean, now what should I do?

Thank you all in advance.
Reddy Prashanth
Ranch Hand

Joined: Aug 09, 2005
Posts: 61
Hi Chaitanya,

There are good number of books on hibernate. You can pick one from your nearest book store. I am reading "Java Persistence with Hibernate" from manning publisher. It is a nice book and helps you to learn hibernate quickly. You can also refer to hibernate documentation pdf at http://www.hibernate.org/docs.


Coming to your question, how do you approach, to persist the data in DB , without hibernate ??
Generally , a DAO class with SQL operations and you'll be calling this DAO class somewhere in your business objects or in controller class like struts action class or simply a servlet. right ??

Similar approach you can follow with hibernate. In the DAO class, write the CRUD operations using hibernate API like session.save(). Call this DAO in you controller after validations. (hope you have mapped all your bean properties in hbm files)

Of course, there are a good number of design patterns to consider but this simple example can help you to start hibernate.



chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 800

Should I place the jar files in lib folder or classes folder?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to start hibernating?
 
Similar Threads
where to put hibernate configuration xml files in a web application
tomacat5.5.12
MVC without struts
Learn Spring and Hibernate?