Nearby lessons
4 of 19Hibernate - Retrieving Records from the Database
- Understand Hibernate - Retrieving Records from the Database
- See working code examples
- Learn from common mistakes and Q&A
Learn Hibernate - Retrieving Records from the Database step by step — simple explanations, complete programs with their output, common beginner mistakes, and exam-style MCQs.
Retrieving Records from the Database
- } catch (Exception e) {
- e.printStackTrace();
- }finally {
- session_Factory.close();
- session.close();
HIBERNATE with My SQL Database
If we want to use MySQL Database for Hibernate applications then we have provide the following changes.
In Hibernate Configuration File: : com.mysql.jdbc.Driver Driver Class Name : jdbc:mysql://localhost:3306/db_Name Driver URL : root DB User Name : root DB Password : org.hibernate.dialect.MySQLDialect Dialect
Note: We must add mysql-connector-java-5.0.8-bin.jar file to Hibernate3_Lib.
In Hibernate Applications, it is not suggestible to manage Configuration object and SessionFactory object in Client Application directly, because, these two objects are providing Hibernate Boot strapping. In futer if we want to change boot strapping mechanisms then we have to provide changes in Client Application, it may effect our persistence operations. To avoid this type of problems we have to use a separate Utility class to prepare Configuration and SessionFactory object.
HIBERNATE with My SQL Database — Employee.java
Example:
HIBERNATE with My SQL Database — Employee.hbm.xml
HIBERNATE with My SQL Database — hibernate.cfg.xml
HIBERNATE with My SQL Database — HibernateUtil.java
HIBERNATE with My SQL Database — ClientApp.java
AWT/GUI-Hibernate Integration Application — Student.java
AWT/GUI-Hibernate Integration Application — Student.hbm.xml
AWT/GUI-Hibernate Integration Application — hibernate.cfg.xml
AWT/GUI-Hibernate Integration Application — HibernateUtil.java
AWT/GUI-Hibernate Integration Application — StudentService.java
AWT/GUI-Hibernate Integration Application — SearchFrame.java
AWT/GUI-Hibernate Integration Application — ClientApp.java
Servlet_Hibernate_Application — loginform.html
Servlet_Hibernate_Application — success.html
Servlet_Hibernate_Application — failure.html
Servlet_Hibernate_Application — hibernate.cfg.xml
Servlet_Hibernate_Application — User.hbm.xml
Servlet_Hibernate_Application — HibernateUtil.java
Servlet_Hibernate_Application — User.java
Servlet_Hibernate_Application — UserService.java
Servlet_Hibernate_Application — LoginServlet.java
Servlet_Hibernate_Application — web.xml
JSP_Hibernate_Application — searchform.html
JSP_Hibernate_Application — notexisted.html
JSP_Hibernate_Application — display.jsp
JSP_Hibernate_Application — search.jsp
JSP_Hibernate_Application — Customer.java
JSP_Hibernate_Application — Customer.hbm.xml
JSP_Hibernate_Application — hibernate.cfg.xml
JSP_Hibernate_Application — web.xml
- Key ideas of Hibernate - Retrieving Records from the Database explained simply
- Ready-to-use code examples
- Exam-style questions at the end