• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

org.hibernate.MappingException: Unknown entity: com.hp.ExamRegister in a struts2 tiles integration

 
Greenhorn
Posts: 15
Hibernate Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to display a layout here as is given in Layout.jsp. But I get an exception as mentioned in the subject. ExamRegister is a table in my database and i have its POJO also in package com.hp. When i run the project i get the login form i.e. index.jsp. When i enter the details in the form and click the login button the exception is reported.
Please could anybody tell me what is missing and where.
Thanks !!

tiles.xml


web.xml


struts.xml


Layout.jsp



LoginAction.java


exception
 
Marshal
Posts: 74048
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

You appear to have arrived in the wrong forum; I shall try moving you to the Struts forum.
 
Archi Sharma
Greenhorn
Posts: 15
Hibernate Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks . Well, I posted again in the correct framework.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This exception:

leads me to believe that this is a Hibernate issue. What is the full stack trace of the error from the Tomcat log file?
Do you have ExamRegister configured as a Hibernate entity? You don't show us the source or the Hibernate config files.
 
Archi Sharma
Greenhorn
Posts: 15
Hibernate Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Following is the stack trace and the cfg file respectively.I would also like to mention that I am using Netbeans ide.



cfg


 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The exception there seems pretty straightforward:



I'd like to know why it mentions an insert to an "employee" table when your class you are fetching in LoginAction is ExamRegister. This leads me to believe that you are not showing us the full stack trace from your first post.
How did you set up ExamRegister with Hibernate? A mapping file or annotations? Can you show us the ExamRegister class and the mapping file (if any).
 
Archi Sharma
Greenhorn
Posts: 15
Hibernate Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am sorry I posted the wrong stack trace.The correct one is as follows:


exam_register is a table in my database. ExamRegister is the corresponding POJO for the table.ExamRegister class and the corresponding XML are as follows:


ExamRegister.java



ExamRegister.hbm.xml



 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So how is Hibernate supposed to find out about ExamRegister.hbm.xml?
 
Archi Sharma
Greenhorn
Posts: 15
Hibernate Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From the configuration file??
 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in configuration refer your hbm file

cfg
 
Archi Sharma
Greenhorn
Posts: 15
Hibernate Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did as you said Arun, but I got an exception:
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The mapping tag should go inside the session-factory tag.
 
Archi Sharma
Greenhorn
Posts: 15
Hibernate Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Still getting the following exception:

 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When Arun wrote "file-path", he meant for you to put in the relative path from the Hibernate config file to the ExamRegister.hbm.xml
 
Archi Sharma
Greenhorn
Posts: 15
Hibernate Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ohh such a dumb mistake! Well, thanks for your help. Much appreciated.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic