Table Per Hierarchy – Hibernate

Table Per Hierarchy – Hibernate
Table per class hierarchy is mapping all values in one table. The code given below is tested in NetBeans.

1) In Netbeans file–>new project –>java –>java webapplication
2) Give webapplication a name(“TPH”) –> Next
3) Select Hibernate Framework and choose the database where you want to create this table

Create 3 java files,

Create a folder named “pojo” inside source packages


Right Click –> New–> Hibernate Mapping Wizard –>student.hbm.xml

Inside pojo create a javaclass


id type Name Department regularfees partimefees
1 pt Beta Models null 20000
2 Regular Delta Science 12000 null
3 stud Alpha Robotics null null







One thought to “Table Per Hierarchy – Hibernate”

Leave a Reply

Your email address will not be published. Required fields are marked *