• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

class is not mapped error

 
jim mcnamara
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi-

I can't figure out why the class is not mapped! Maybe a fresh set of eyes and/or ideas can help. Thanks for any assistance.
I haven't looked at Java in a long time.

I tried with both org.apache.derby.ui.test.Cities and without the package prefixes.

Here is my hbm.xml .java .cfg.xml



 
jim mcnamara
Ranch Hand
Posts: 70
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops... sorry about the code tags- THANKS!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My pleasure.
 
jim mcnamara
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the error in the hibernate query result is:

org.hibernate.hql.ast.QuerySyntaxException: Cities is not mapped [from Cities]

thanks
 
jim mcnamara
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI-

I thought I'd outline my project folder set up too...
I hope seeing this helps. THANKS!

 
Paul Clapham
Sheriff
Posts: 21551
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
org.apache.derby.ui.test


Did you really call a folder by that name? That's not how to do it for a Java class.

You need a "test" folder inside a "ui" folder inside a "derby" folder inside... hopefully you get the idea.
 
jim mcnamara
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi-

No, I didn't call a folder by that name. It was a package. Sorry.

The package is in the source folder and it is like org.apache.derby.ui.test.ClassName.

Thanks everyone for helping. With your encouragement, I have a hello world type project.

The Hibernate query result is now working (except I have to edit the pojo to handle the strings differently)!

One of the buggers that got me was the underscores in the table names for i.e. City_Name.
I got rid of those as I didn't need to have all the fields from the table mapped.

Also, in the sql error window I didn't know how to expand the error listed to read the stack trace until now.

This makes me very HAPPY. Hopefully I can practice a different types of mappings next.

THANKS AGAIN!


 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jim mcnamara wrote:No, I didn't call a folder by that name. It was a package. Sorry.


The folder structure must mimic the package structure. Must. There's no room for creativity.

Moreover, you should not be using a package name that starts with org.apache -- that's reserved for the Apache project. You should be using your own custom package hierarchy.
 
jim mcnamara
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI-

thanks for the cool tips!

Have a cool night,
jim
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic