• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

hibernate problem, what to try next?

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
having a first go at hibernate (with xdoclet), and i've gotten to a point where i get an error and don't know how to proceed. the error looks like this:
[java] (cfg.Environment 519 ) using CGLIB reflection optimizer
[java] (cfg.Configuration 347 ) Mapping resource: org/me/hibernate/HClubber.hbm.xml
[java] (cfg.Binder 229 ) Mapping class: org.me.hibernate.HClubber -> clubbers
[java] (cfg.Configuration 613 ) processing one-to-many association mappings
[java] net.sf.hibernate.MappingException: Association references unmapped class: org.me.hibernate.HClubberComment

so it looks to me like one of three problems:
1) cannot find class org.me.hibernate.HClubberComment in classpath
2) cannot find hibernate config HClubberComment.hbm.xml in classpath
3) my mapping is set up incorrectly

1 and 2 i can safely dismiss. if i list the class files (and 'classes' is on my classpath):
[jimmer@localhost bookclub]$ ls classes/org/jimmer/bookclub/hibernate/
HClubber.class HClubber.hbm.xml HClubberComment.class HClubberComment.hbm.xml

so, my mapping... i've got a one-to-many relationship between 'clubber' and 'comments'. tables are straightforward (postgresql backend btw). the two classes are annotated as:

HClubber.java:

and HClubberComment.java:


the xdoclet-generated files read, in part.

HClubber.hbm.xml:



HClubberComment.hbm.xml:


now, i don't pretend to know what all these attributes mean, but this looks pretty okay to me, based on other examples i've seen.

so, can anyone see anything wrong here? more importantly, what i can i do to futher debug this? thanks.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's not the classpath and it's (probably) not your mappings. What it looks like is you have not loaded HClubberComment into the SessionFactory via your Configuration. Make sure it is included in hibernate.cfg.xml, if you are configuring hibernate that way, or that you have added it to your configurationg manually if you are doing it that way.
 
john guthrie
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i sure haven't - thanks! (!!!)

john
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It helps me too, thanks!
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"kizza",
Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with display names get deleted, often without warning

thanks,
Dave
reply
    Bookmark Topic Watch Topic
  • New Topic