Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

org.hibernate.TypeMismatchException [SOLVED] (silly one)

 
guillermo granados
Greenhorn
Posts: 2
Java jQuery MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got:
org.hibernate.TypeMismatchException: Provided id of the wrong type. Expected: class java.lang.String, got class java.lang.Long

When calling:



The line marked is:


But this happens only when pedidoId has a value like "11A", and don't with values like "11".
As you can see, in the line with the System.ou.println i got the correct string.

So, what's happenig?
Any ideas?

this is the mapping of the id part:



Thanks!!
 
guillermo granados
Greenhorn
Posts: 2
Java jQuery MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, my mistake.

I have found my error.

I wanted to have id's like 11 and 11A or 11B, etc, coz i needed to known whose pedido was derivated from another pedido, but in a part of my app, i have to show (in a select) the main pedido's, so the user can choose it.
So I needed to order them main pedido's (just to be polite with the final user), and i used a comparator for that situation, like this:



As you can see, I decided that getIdPedido returns a long value (in wich case can be only, when the pedido was a main one), but it doesn't.
Sorry, i'm a green horns
My mistake!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic