Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

org.hibernate. MappingException

 
Pablo M�ller
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm getting this error and I can't figure out what is it:
(I had to add a few spaces in the stack trace to prevent a 30 characters long words error)


this is the mapping document:



and this is Version class where it's failing:



Thanks.
Pablo
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interesting, it looks correct, but it could be a simple single character error like a simple mispelling or the package is mispelled.

Just out of curiosity can you seperate all your class mapping into seperate hbm.xml files? One for each class mapping.

Mark
 
Pablo M�ller
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.
I just tried separating the files and I still get the same error.
If you have any other idea it will be more than welcome
Bye and thanks again.
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"<property name="usuario" type="wuw.model.Usuario"/>"

Remove the "type="wuw.model.Usuario"", Hibernate can determine the type from the type of the attribute or from the return type of the Getter method.

Also, in Usuario class, I was wondering if maybe the set of amigos, might be where the exception is occurring, because you are trying to go to a different table but the class type is the same Usuario class, which is mapped to the usuarios table, not the usuario_amigos table. There is a problem with that, you can't have the one class Usuario trying to save to two different tables.
I say this is the biggest problem and would cause some exception to be thrown.


Mark
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!