• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Even with the class defined, i get the error: org.hibernate.MappingException: Unknown entity

 
Greenhorn
Posts: 29
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's the class I want to create.

I already changed the imports and re-edited the annotations, but the error continued. I also changed update to create, but nothing has changed, I honestly do not know what's going on




The SessionBuild class




That's the cfg.xml file, as you can see, the class is correctly mapped, what can be wrong?




And here is the DAO factory for User class:



I dont know why a cant reach the User class, try everything, but with no sucess.

Any clues?
 
Marshal
Posts: 28175
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


That line says that your Usuario class is in the br.com.javaparaweb.financeiro.usuario package. But the Usuario class which you posted is not in any package, so the mapping won't find it.

Or did you just omit the package declaration from what you posted?
 
Jrcastro Ribeiro
Greenhorn
Posts: 29
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:

That line says that your Usuario class is in the br.com.javaparaweb.financeiro.usuario package. But the Usuario class which you posted is not in any package, so the mapping won't find it.

Or did you just omit the package declaration from what you posted?



Thats the strcuture of the project:



As you can see, the class "Usuario" is inside the package

 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jrcastro Ribeiro wrote:


Completely unrelated, but that code makes me cry. I hope that's been generated by your IDE, because I'd hate to have you waste time on writing such verbose code.

Unless you are using Java 6, you should make use of java.util.Objects:
I've just halved the number of lines of code of those two methods (equals went from 53 to 19, and that is with added { and }!), and made it more readable at the same time.

Note the calculation of hashCode of ativo. Boolean.valueOf(ativo) always returns either Boolean.TRUE or Boolean.FALSE, so this does not require any new objects. Java 8 has added static hashCode methods to all primitive wrapper classes, making it a lot easier to write hashCode methods. Especially for long, float and double it was quite verbose. Compare:
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic