It's not a secret anymore!*
The moose likes Object Relational Mapping and the fly likes One to Many Mapping : org.hibernate.MappingException: Association references unmapped class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "One to Many Mapping : org.hibernate.MappingException: Association references unmapped class" Watch "One to Many Mapping : org.hibernate.MappingException: Association references unmapped class" New topic
Author

One to Many Mapping : org.hibernate.MappingException: Association references unmapped class

Arun Giridharan
Ranch Hand

Joined: Sep 30, 2010
Posts: 290

i'm having 2 entity Student and Address trying to do 12M

Student


student.hbm.xml


Address.java


address.hbm.xml


i'm getting followin problem Log

INFO: Reading mappings from resource : com/hbm/student.hbm.xml
Nov 30, 2011 12:56:11 AM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: com.home.student.Student -> STUDENT
Nov 30, 2011 12:56:11 AM org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
Exception in thread "main" org.hibernate.MappingException: Association references unmapped class: com.home.student.Address
at org.hibernate.cfg.HbmBinder.bindCollectionSecondPass(HbmBinder.java:2380)
at org.hibernate.cfg.HbmBinder$CollectionSecondPass.secondPass(HbmBinder.java:2662)
at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:43)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1130)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1286)
at com.home.student.Demo.main(Demo.java:18)
ntumba lobo
Ranch Hand

Joined: Oct 21, 2008
Posts: 180
is your com/hbm/address.hbm.xml in the same location as com/hbm/student.hbm.xml and is it declared in your hibernate,cfg.xml?


SCJP 5 , SCWCD 5, SCEA 5
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: One to Many Mapping : org.hibernate.MappingException: Association references unmapped class
 
Similar Threads
org.hibernate.MappingException: table refers to an unmapped class
Foreign key must have same number of columns
SQLGrammarException
Hibernate example error message
Reason for stack overflow exception while trying to read hibernate managed objects