org.hibernate.MappingException: Unknown entity: com.construction.beans.PersonalInfo

Hibernate JIRA | Achappan M | 9 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Hil, I got the following exception when i saved the data into the database. I can identified, my data is not committed in db. Here i specified my java classes. Please anyone guide me to solve this problem. 21:27:44,359 ERROR [STDERR] org.hibernate.MappingException: Unknown entity: com.construction.beans.PersonalInfo at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:610) at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1246) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:89) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186) at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175) at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70) at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:524) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:514) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:510) at com.construction.DB.DBUtil.save(DBUtil.java:48) at com.construction.Servlets.AddPersonalInfo.personalInfo(AddPersonalInfo.java:48) at com.construction.Servlets.AddPersonalInfo.doGet(AddPersonalInfo.java:25) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446) at java.lang.Thread.run(Unknown Source) personalInfo.hbm File: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="com.construction.beans.PersonalInfo" table="personalinfo" > <id name="emp_code" column = "EMP_CODE" type="java.lang.Long"> <generator class="increment"/> </id> <property name="employee_Name" type="java.lang.String"/> <property name="father_Name" type="java.lang.String"/> <property name="mother_Name" type="java.lang.String"/> <property name="dob" type="java.lang.String"/> <property name="gender" type="java.lang.String"/> <property name="marital_status" type="java.lang.String"/> <property name="bloodgroup" type="java.lang.String"/> <property name="qualification" type="java.lang.String"/> <property name="address" type="java.lang.String"/> <property name="email" type="java.lang.String"/> <property name="mobileno" type="java.lang.String"/> <one-to-one name="salaryInfo" class="com.construction.beans.SalaryInfo" cascade="all" constrained="false"/> <!-- property name="empPhoto" type="java.lang.String"/--> </class> </hibernate-mapping> salaryInfo.hbm.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="com.construction.beans.SalaryInfo" table="SalaryInfo" > <id name="emp_code" column = "EMP_CODE" type="java.lang.Long"> <generator class="increment"/> </id> <property name="empno" type="java.lang.String"/> <property name="doj" type="java.lang.String"/> <property name="designation" type="java.lang.String"/> <property name="accountno" type="java.lang.String"/> <property name="basic" type="java.lang.String"/> <property name="allowance" type="java.lang.String"/> <property name="ot_per_hour" type="java.lang.String"/> <property name="pfno" type="java.lang.String"/> <property name="esicno" type="java.lang.String"/> <property name="mem_UHID" type="java.lang.String"/> <property name="licno" type="java.lang.String"/> <!-- property name="empPhoto" type="java.lang.String"/--> </class> </hibernate-mapping> Persistent Class: package com.construction.beans; import java.io.Serializable; public class PersonalInfo implements Serializable{ /**Personal Details**/ private long emp_code; private String employee_Name; private String father_Name; private String mother_Name; private String dob; private String gender; private String marital_status; private String bloodgroup; private String qualification; private String address; private String email; private String mobileno; private String empPhoto; private SalaryInfo salaryInfo; public long getEmp_code() { return emp_code; } public void setEmp_code(long emp_code) { this.emp_code = emp_code; } public String getEmployee_Name() { return employee_Name; } public void setEmployee_Name(String employee_Name) { this.employee_Name = employee_Name; } public String getFather_Name() { return father_Name; } public void setFather_Name(String father_Name) { this.father_Name = father_Name; } public String getMother_Name() { return mother_Name; } public void setMother_Name(String mother_Name) { this.mother_Name = mother_Name; } public String getDob() { return dob; } public void setDob(String dob) { this.dob = dob; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public String getMarital_status() { return marital_status; } public void setMarital_status(String marital_status) { this.marital_status = marital_status; } public String getBloodgroup() { return bloodgroup; } public void setBloodgroup(String bloodgroup) { this.bloodgroup = bloodgroup; } public String getQualification() { return qualification; } public void setQualification(String qualification) { this.qualification = qualification; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getMobileno() { return mobileno; } public void setMobileno(String mobileno) { this.mobileno = mobileno; } public String getEmpPhoto() { return empPhoto; } public void setEmpPhoto(String empPhoto) { this.empPhoto = empPhoto; } public SalaryInfo getSalaryInfo() { return salaryInfo; } public void setSalaryInfo(SalaryInfo salaryInfo) { this.salaryInfo = salaryInfo; } } DBUtil.java package com.construction.DB; import java.io.File; import java.util.List; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import org.hibernate.tool.hbm2ddl.SchemaExport; import com.construction.beans.PersonalInfo; public class DBUtil { private SessionFactory sf; private static DBUtil ed=null; public static DBUtil create() { if(ed==null) { ed=new DBUtil(); System.out.println("instance created"); } return ed; } private DBUtil() { String path=System.getProperty("user.dir")+File.separator+"config"+File.separator; File f=new File(path+"hibernate.cfg.xml"); Configuration cfg=new Configuration().configure(f); sf=cfg.buildSessionFactory(); //new SchemaExport(cfg).create(true,true); } //create public void save(Object o) { Session session = sf.openSession(); try { session.save(o); System.out.println("Save session Object" + o); session.beginTransaction().commit(); } catch(Exception e) { System.out.println("Inside Exception=========>"); e.printStackTrace(); session.beginTransaction().rollback(); } finally { session.close(); } } public void update(Object o) { Session session=sf.openSession(); try { session.update(o); session.beginTransaction().commit(); } catch(Exception e) { session.beginTransaction().rollback(); } finally { session.close(); } } public void delete(Object o) { Session session=sf.openSession(); try { session.delete(o); session.beginTransaction().commit(); } catch(Exception e) { session.beginTransaction().rollback(); } finally { session.close(); } } public List getLoginFormDetails() { Session session=sf.openSession(); List l = session.createCriteria(LoginForm.class).list(); return l; } public List getPersonalInfoDetails() { Session session=sf.openSession(); List l = session.createCriteria(PersonalInfo.class).list(); System.out.println("DBUtil: -----> listsize" + l.size()); return l; } } My servlet Class: package com.construction.Servlets; import java.io.*; import java.util.Iterator; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.*; import com.construction.DB.DBInit; import com.construction.DB.DBUtil; import com.construction.beans.*; public class AddPersonalInfo extends HttpServlet { DBUtil util; protected void doGet(HttpServletRequest httpRequest, HttpServletResponse httpResponse) throws ServletException, IOException { //To set the content type for the server //httpResponse.setContentType("text/html"); savePersonalInfo(httpRequest); //Getting the data from the server and print the data into //the browser. // PrintWriter print = httpResponse.getWriter(); } public void savePersonalInfo(HttpServletRequest httpRequest) { /* * Get the employee personal information from the user and * set it into the PersonalInfo */ PersonalInfo personalInfo = new PersonalInfo(); //personalInfo.setEmp_code(Long.parseLong(httpRequest.getParameter("emp_code"))); //personalInfo.setEmp_code(001); personalInfo.setEmployee_Name(httpRequest.getParameter("employee_Name")); personalInfo.setFather_Name(httpRequest.getParameter("father_Name")); personalInfo.setMother_Name(httpRequest.getParameter("mother_Name")); personalInfo.setDob(httpRequest.getParameter("dob")); personalInfo.setGender(httpRequest.getParameter("gender")); personalInfo.setMarital_status(httpRequest.getParameter("marital_status")); personalInfo.setBloodgroup(httpRequest.getParameter("bloodgroup")); personalInfo.setQualification(httpRequest.getParameter("qualification")); personalInfo.setAddress(httpRequest.getParameter("address")); personalInfo.setEmail(httpRequest.getParameter("email")); personalInfo.setMobileno(httpRequest.getParameter("mobileno")); personalInfo.setEmpPhoto(httpRequest.getParameter("empPhoto")); System.out.println("Get Emp Name"+personalInfo.getEmployee_Name() ); System.out.println("Get Father Name"+personalInfo.getFather_Name()); /* * Get the employee salary details from the user and * set it into the SalaryInfo */ SalaryInfo salaryInfo = new SalaryInfo(); //salaryInfo.setEmp_code(001); /*salaryInfo.setEmpno(httpRequest.getParameter("empno")); salaryInfo.setDoj(httpRequest.getParameter("doj")); salaryInfo.setDesignation(httpRequest.getParameter("designation")); salaryInfo.setAccountno(httpRequest.getParameter("accountno")); salaryInfo.setBasic(httpRequest.getParameter("basic")); salaryInfo.setAllowance(httpRequest.getParameter("allowance")); salaryInfo.setOt_per_hour(httpRequest.getParameter("ot_per_hour")); salaryInfo.setPfno(httpRequest.getParameter("pfno")); salaryInfo.setEsicno(httpRequest.getParameter("esicno")); salaryInfo.setMem_UHID(httpRequest.getParameter("mem_UHID")); salaryInfo.setLicno(httpRequest.getParameter("licno")); System.out.println("Get Emp Name"+salaryInfo.getEmpno()); System.out.println("Get Father Name"+salaryInfo.getDoj());*/ //set the salary details into the personalinfo personalInfo.setSalaryInfo(salaryInfo); //save peronal information to the database // create the object for the DBUtil util = DBUtil.create(); util.save(personalInfo); util.save(salaryInfo); System.out.println("Object is creted for DBUtil"); /*if(util != null) { System.out.println("print Util Object" + util); //if(personalInfo != null) System.out.println("Save Persional & Salary Information "); util.save(personalInfo); System.out.println(personalInfo); List list = util.getPersonalInfoDetails(); System.out.println("List " + list); System.out.println("List " + list.size()); Iterator iterator = list.iterator(); System.out.println("Iterator"+ iterator); while (iterator.hasNext ()) { String o = (String) iterator.next (); System.out.println(o); } System.out.println("Persional Information is Saved Sucessfully"); //util.save(salaryInfo); //System.out.println("Salary Information is Saved Sucessfully"); }*/ } } Please send me the solution for my codings. Thank You!

    Hibernate JIRA | 9 years ago | Achappan M
    org.hibernate.MappingException: Unknown entity: com.construction.beans.PersonalInfo
  2. 0

    Hil, I got the following exception when i saved the data into the database. I can identified, my data is not committed in db. Here i specified my java classes. Please anyone guide me to solve this problem. 21:27:44,359 ERROR [STDERR] org.hibernate.MappingException: Unknown entity: com.construction.beans.PersonalInfo at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:610) at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1246) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:89) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186) at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175) at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70) at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:524) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:514) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:510) at com.construction.DB.DBUtil.save(DBUtil.java:48) at com.construction.Servlets.AddPersonalInfo.personalInfo(AddPersonalInfo.java:48) at com.construction.Servlets.AddPersonalInfo.doGet(AddPersonalInfo.java:25) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446) at java.lang.Thread.run(Unknown Source) personalInfo.hbm File: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="com.construction.beans.PersonalInfo" table="personalinfo" > <id name="emp_code" column = "EMP_CODE" type="java.lang.Long"> <generator class="increment"/> </id> <property name="employee_Name" type="java.lang.String"/> <property name="father_Name" type="java.lang.String"/> <property name="mother_Name" type="java.lang.String"/> <property name="dob" type="java.lang.String"/> <property name="gender" type="java.lang.String"/> <property name="marital_status" type="java.lang.String"/> <property name="bloodgroup" type="java.lang.String"/> <property name="qualification" type="java.lang.String"/> <property name="address" type="java.lang.String"/> <property name="email" type="java.lang.String"/> <property name="mobileno" type="java.lang.String"/> <one-to-one name="salaryInfo" class="com.construction.beans.SalaryInfo" cascade="all" constrained="false"/> <!-- property name="empPhoto" type="java.lang.String"/--> </class> </hibernate-mapping> salaryInfo.hbm.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="com.construction.beans.SalaryInfo" table="SalaryInfo" > <id name="emp_code" column = "EMP_CODE" type="java.lang.Long"> <generator class="increment"/> </id> <property name="empno" type="java.lang.String"/> <property name="doj" type="java.lang.String"/> <property name="designation" type="java.lang.String"/> <property name="accountno" type="java.lang.String"/> <property name="basic" type="java.lang.String"/> <property name="allowance" type="java.lang.String"/> <property name="ot_per_hour" type="java.lang.String"/> <property name="pfno" type="java.lang.String"/> <property name="esicno" type="java.lang.String"/> <property name="mem_UHID" type="java.lang.String"/> <property name="licno" type="java.lang.String"/> <!-- property name="empPhoto" type="java.lang.String"/--> </class> </hibernate-mapping> Persistent Class: package com.construction.beans; import java.io.Serializable; public class PersonalInfo implements Serializable{ /**Personal Details**/ private long emp_code; private String employee_Name; private String father_Name; private String mother_Name; private String dob; private String gender; private String marital_status; private String bloodgroup; private String qualification; private String address; private String email; private String mobileno; private String empPhoto; private SalaryInfo salaryInfo; public long getEmp_code() { return emp_code; } public void setEmp_code(long emp_code) { this.emp_code = emp_code; } public String getEmployee_Name() { return employee_Name; } public void setEmployee_Name(String employee_Name) { this.employee_Name = employee_Name; } public String getFather_Name() { return father_Name; } public void setFather_Name(String father_Name) { this.father_Name = father_Name; } public String getMother_Name() { return mother_Name; } public void setMother_Name(String mother_Name) { this.mother_Name = mother_Name; } public String getDob() { return dob; } public void setDob(String dob) { this.dob = dob; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public String getMarital_status() { return marital_status; } public void setMarital_status(String marital_status) { this.marital_status = marital_status; } public String getBloodgroup() { return bloodgroup; } public void setBloodgroup(String bloodgroup) { this.bloodgroup = bloodgroup; } public String getQualification() { return qualification; } public void setQualification(String qualification) { this.qualification = qualification; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getMobileno() { return mobileno; } public void setMobileno(String mobileno) { this.mobileno = mobileno; } public String getEmpPhoto() { return empPhoto; } public void setEmpPhoto(String empPhoto) { this.empPhoto = empPhoto; } public SalaryInfo getSalaryInfo() { return salaryInfo; } public void setSalaryInfo(SalaryInfo salaryInfo) { this.salaryInfo = salaryInfo; } } DBUtil.java package com.construction.DB; import java.io.File; import java.util.List; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import org.hibernate.tool.hbm2ddl.SchemaExport; import com.construction.beans.PersonalInfo; public class DBUtil { private SessionFactory sf; private static DBUtil ed=null; public static DBUtil create() { if(ed==null) { ed=new DBUtil(); System.out.println("instance created"); } return ed; } private DBUtil() { String path=System.getProperty("user.dir")+File.separator+"config"+File.separator; File f=new File(path+"hibernate.cfg.xml"); Configuration cfg=new Configuration().configure(f); sf=cfg.buildSessionFactory(); //new SchemaExport(cfg).create(true,true); } //create public void save(Object o) { Session session = sf.openSession(); try { session.save(o); System.out.println("Save session Object" + o); session.beginTransaction().commit(); } catch(Exception e) { System.out.println("Inside Exception=========>"); e.printStackTrace(); session.beginTransaction().rollback(); } finally { session.close(); } } public void update(Object o) { Session session=sf.openSession(); try { session.update(o); session.beginTransaction().commit(); } catch(Exception e) { session.beginTransaction().rollback(); } finally { session.close(); } } public void delete(Object o) { Session session=sf.openSession(); try { session.delete(o); session.beginTransaction().commit(); } catch(Exception e) { session.beginTransaction().rollback(); } finally { session.close(); } } public List getLoginFormDetails() { Session session=sf.openSession(); List l = session.createCriteria(LoginForm.class).list(); return l; } public List getPersonalInfoDetails() { Session session=sf.openSession(); List l = session.createCriteria(PersonalInfo.class).list(); System.out.println("DBUtil: -----> listsize" + l.size()); return l; } } My servlet Class: package com.construction.Servlets; import java.io.*; import java.util.Iterator; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.*; import com.construction.DB.DBInit; import com.construction.DB.DBUtil; import com.construction.beans.*; public class AddPersonalInfo extends HttpServlet { DBUtil util; protected void doGet(HttpServletRequest httpRequest, HttpServletResponse httpResponse) throws ServletException, IOException { //To set the content type for the server //httpResponse.setContentType("text/html"); savePersonalInfo(httpRequest); //Getting the data from the server and print the data into //the browser. // PrintWriter print = httpResponse.getWriter(); } public void savePersonalInfo(HttpServletRequest httpRequest) { /* * Get the employee personal information from the user and * set it into the PersonalInfo */ PersonalInfo personalInfo = new PersonalInfo(); //personalInfo.setEmp_code(Long.parseLong(httpRequest.getParameter("emp_code"))); //personalInfo.setEmp_code(001); personalInfo.setEmployee_Name(httpRequest.getParameter("employee_Name")); personalInfo.setFather_Name(httpRequest.getParameter("father_Name")); personalInfo.setMother_Name(httpRequest.getParameter("mother_Name")); personalInfo.setDob(httpRequest.getParameter("dob")); personalInfo.setGender(httpRequest.getParameter("gender")); personalInfo.setMarital_status(httpRequest.getParameter("marital_status")); personalInfo.setBloodgroup(httpRequest.getParameter("bloodgroup")); personalInfo.setQualification(httpRequest.getParameter("qualification")); personalInfo.setAddress(httpRequest.getParameter("address")); personalInfo.setEmail(httpRequest.getParameter("email")); personalInfo.setMobileno(httpRequest.getParameter("mobileno")); personalInfo.setEmpPhoto(httpRequest.getParameter("empPhoto")); System.out.println("Get Emp Name"+personalInfo.getEmployee_Name() ); System.out.println("Get Father Name"+personalInfo.getFather_Name()); /* * Get the employee salary details from the user and * set it into the SalaryInfo */ SalaryInfo salaryInfo = new SalaryInfo(); //salaryInfo.setEmp_code(001); /*salaryInfo.setEmpno(httpRequest.getParameter("empno")); salaryInfo.setDoj(httpRequest.getParameter("doj")); salaryInfo.setDesignation(httpRequest.getParameter("designation")); salaryInfo.setAccountno(httpRequest.getParameter("accountno")); salaryInfo.setBasic(httpRequest.getParameter("basic")); salaryInfo.setAllowance(httpRequest.getParameter("allowance")); salaryInfo.setOt_per_hour(httpRequest.getParameter("ot_per_hour")); salaryInfo.setPfno(httpRequest.getParameter("pfno")); salaryInfo.setEsicno(httpRequest.getParameter("esicno")); salaryInfo.setMem_UHID(httpRequest.getParameter("mem_UHID")); salaryInfo.setLicno(httpRequest.getParameter("licno")); System.out.println("Get Emp Name"+salaryInfo.getEmpno()); System.out.println("Get Father Name"+salaryInfo.getDoj());*/ //set the salary details into the personalinfo personalInfo.setSalaryInfo(salaryInfo); //save peronal information to the database // create the object for the DBUtil util = DBUtil.create(); util.save(personalInfo); util.save(salaryInfo); System.out.println("Object is creted for DBUtil"); /*if(util != null) { System.out.println("print Util Object" + util); //if(personalInfo != null) System.out.println("Save Persional & Salary Information "); util.save(personalInfo); System.out.println(personalInfo); List list = util.getPersonalInfoDetails(); System.out.println("List " + list); System.out.println("List " + list.size()); Iterator iterator = list.iterator(); System.out.println("Iterator"+ iterator); while (iterator.hasNext ()) { String o = (String) iterator.next (); System.out.println(o); } System.out.println("Persional Information is Saved Sucessfully"); //util.save(salaryInfo); //System.out.println("Salary Information is Saved Sucessfully"); }*/ } } Please send me the solution for my codings. Thank You!

    Hibernate JIRA | 9 years ago | Achappan M
    org.hibernate.MappingException: Unknown entity: com.construction.beans.PersonalInfo
  3. 0

    Hibernate mapping exception: unknow entity

    Stack Overflow | 3 years ago | Ali Asad
    org.hibernate.MappingException: Unknown entity: in.shivasoft.pojo.Users
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Hibernate Eclipse Unknown Entity (using javax.persistence.Entity)

    Stack Overflow | 3 years ago | Mudassir Shahzad
    org.hibernate.MappingException: Unknown entity: com.mywebservice.domain.Account
  6. 0

    hibernate annotation curd operation in j2ee

    Stack Overflow | 3 years ago | chirag soni
    org.hibernate.MappingException: Unknown entity: com.pojo1.Student

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.hibernate.MappingException

      Unknown entity: com.construction.beans.PersonalInfo

      at org.hibernate.impl.SessionFactoryImpl.getEntityPersister()
    2. Hibernate
      SessionImpl.save
      1. org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:610)
      2. org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1246)
      3. org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:89)
      4. org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
      5. org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
      6. org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
      7. org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
      8. org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
      9. org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:524)
      10. org.hibernate.impl.SessionImpl.save(SessionImpl.java:514)
      11. org.hibernate.impl.SessionImpl.save(SessionImpl.java:510)
      11 frames
    3. com.construction.DB
      DBUtil.save
      1. com.construction.DB.DBUtil.save(DBUtil.java:48)
      1 frame
    4. com.construction.Servlets
      AddPersonalInfo.doGet
      1. com.construction.Servlets.AddPersonalInfo.personalInfo(AddPersonalInfo.java:48)
      2. com.construction.Servlets.AddPersonalInfo.doGet(AddPersonalInfo.java:25)
      2 frames
    5. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
      2. javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      2 frames
    6. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      2 frames
    7. JBoss Application Server Tomcat
      ReplyHeaderFilter.doFilter
      1. org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      1 frame
    8. Glassfish Core
      StandardContextValve.invoke
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      3. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      4. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      4 frames
    9. JBoss Application Server Tomcat
      JaccContextValve.invoke
      1. org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
      2. org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      2 frames
    10. Glassfish Core
      ErrorReportValve.invoke
      1. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      2. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      2 frames
    11. JBoss Application Server Tomcat
      CachedConnectionValve.invoke
      1. org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      1 frame
    12. Glassfish Core
      CoyoteAdapter.service
      1. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      2. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      2 frames
    13. Grizzly HTTP
      JIoEndpoint$Worker.run
      1. org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      2. org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      3. org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
      3 frames
    14. Java RT
      Thread.run
      1. java.lang.Thread.run(Unknown Source)
      1 frame