wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes org.hibernate.MappingException: table refers to an unmapped class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "org.hibernate.MappingException: table refers to an unmapped class" Watch "org.hibernate.MappingException: table refers to an unmapped class" New topic
Author

org.hibernate.MappingException: table refers to an unmapped class

Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
this is my main class


this is my student.hbm file


this is my Address.hbm file




this is my student .java file


this is my address.java file


here is the error i got when i am going to run main file


Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

An association from the table STUDENT refers to an unmapped class: com.vaannila.student.Address


Would suggesting that com.vaannila.student.Address is unmapped be too obvious? Perhaps the hbm file is in the wrong spot and not being read.
Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
thanks.
I put classes in default package.
anyway is it a must to implelement a Serilizable interface each java class when using Hibernate?
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

It is a requirement of any good JavaBean, according to the JavaBean spec, to implement Serializable. Hibernate won't cough up locally if you don't explicitly add the 'implements' but you might run into problems later on when you go into production and start passing around entities between cluster members.

-Cameron McKenzie
 
jQuery in Action, 2nd edition
 
subject: org.hibernate.MappingException: table refers to an unmapped class
 
Similar Threads
One to Many Mapping : org.hibernate.MappingException: Association references unmapped class
Error running Hibernate Sample Application
SQLGrammarException
Hibernate example error message
Reason for stack overflow exception while trying to read hibernate managed objects