Hey, I'm pretty new to hibernate and just been playing around with it, I've had this working by just using
the concrete StudentDetails class but then I tried to get it to work by creating an Interface class have having
my concrete StudentDetails implement the StudentInterface class. I can't seem to get it to work now, I think it has something to do with the way I'm using descriminator, subclass and a many-to-one or one-to-one relationship I'm missing, sorry not sure abt this stuff. I manually created a new column in the "student" table called tableDescriminator, but this is not a property of any of my classes. I thought hibernate will use the classname.
Student tableID
student_name
student_address
email
tableDescriminator
contact.hbm.xmlCode:
 <class name="Tute2G.Tute2A.StudentInterface" table="student">
     <id name="id" type="int" column="id" >
        <generator class="increment"/>
     </id>
    
   <discriminator>
        <column name="tableDescriminator"/>
    </discriminator>  
     <property name="studentName">
         <column name="student_name" />
     </property>
    
    <property name="studentAddress">
         <column name="student_address" />
     </property>
    
    <property name="email">
         <column name="email" />
     </property>
       
   <subclass name="Tute2G.Tute2A.StudentInterface"/>
My Student Interface ClassCode:
package Tute2G.Tute2A;
public interface StudentInterface {
   public String getStudentName();
   public void setStudentName(String studentName);
   public String getStudentAddress();
   public void setStudentAddress(String studentAddress);
   public String getEmail();
   public void setEmail(String email);
   public int getId();
   public void setId(int id);
}
My concrete Student classCode:
package Tute2G.Tute2A;
public class Studentdetail implements StudentInterface{
     private String studentName;
     private String studentAddress;
     private String email;
     private int id;
     
     public String getStudentName(){
       return studentName;
     }
     
     public void setStudentName(String studentName){
       this.studentName = studentName;
     }
     
     public String getStudentAddress(){
       return studentAddress;
       
     }
     
     public void setStudentAddress(String studentAddress){
       this.studentAddress = studentAddress;
     }
     
     public String getEmail(){
       return email;
     }
     
     public void setEmail(String email){
       this.email = email;
     }
     
     public int getId(){
       return id;
     }
     
     public void setId(int id){
       this.id = id;
     }
   } 
Error LogException in thread "main" org.hibernate.InvalidMappingException: Could not parse mapping document from resource contact.hbm.xml
	at org.hibernate.cfg.Configuration.addResource(Configuration.java:575)
	at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1593)
	at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1561)
	at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1540)
	at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1514)
	at org.hibernate.cfg.Configuration.configure(Configuration.java:1434)
	at org.hibernate.cfg.Configuration.configure(Configuration.java:1420)
	at Tute2G.Tute2A.StudentCriteriaQueryTest.main(StudentCriteriaQueryTest.java:18)
Caused by: org.hibernate.DuplicateMappingException: Duplicate class/entity mapping Tute2G.Tute2A.StudentInterface
	at org.hibernate.cfg.Mappings.addClass(Mappings.java:118)
	at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:145)
	at org.hibernate.cfg.Configuration.add(Configuration.java:675)
	at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:510)
	at org.hibernate.cfg.Configuration.addResource(Configuration.java:572)
Thanks heaps