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.
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?
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.