Posts

Showing posts with the label Hibernate Framework

MScIT&CA Semester I December 2017 Advance Java Question Paper

Image

Hibernate Table Per Hierarchy using xml file

Image
Inheritance Mapping Hibernate Table Per Hierarchy using xml file By this inheritance strategy, we can map the whole hierarchy by single table only. Here, an extra column (also known as discriminator column) is created in the table to identify the class. Let's understand the problem first. Employee.java public class Employee { private int id; private String name; //generate getters and setters } Regular_Employee.java public class Regular_Employee extends Employee { private float salary; private int bonus; //generate getters and setters } Contract_Employee.java public class Contract_Employee extends Employee { private float pay_per_hour; private String contract_duration; //generate getters and setters } hibernate.cfg.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC         "-//Hibernate/Hibernate Configuration DTD 3.0//EN"         "

Hibernate Web Application Example

Image
Web Application with Hibernate, JSP and Servlet using Eclipse we are going to create a web application with hibernate. We will create Registration form and insert data in table. These data we will collect in servlet and finally insert these data into Database by using hibernate. For creating the web application, we are using JSP for presentation logic, Servlet class for controller layer and DAO class for database access codes. Tools and Technologies: ·          JDK 1.8 ·          Hibernate 3.6.3.Final ·          Eclipse Luna ·          MySQL 5.5. ·          Tomcat 7.0 Follow the steps mentioned below to create this example. Step 1 : Create Dynamic Web Project : Open eclipse IDE,and go to File -> New -> Project ->  and select  Dynamic Web Project , specify the project name as HibernateWebApp and click on next -> finish . Step 2 : Add Jar files for hibernate and mysql : Copy all the jar files as shown below inside lib folder of the project.