Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

class is not mapped error

 
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!
 
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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!

 
Marshal
Posts: 25823
69
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
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
 
The human mind is a dangerous plaything. This tiny ad is pretty safe:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic