Thanks for the quick response, T Mishra.
To be honest I am newbie in Hibernate and I thought that passing an object instead of an ID would be more 'best practices' but I am not really sure.
I had already tried the approach you are suggesting and I didn't succeed either so I rolled back to the one I thought it was better.
This is the line with the query with your suggestion on it:
And the exception:
The variable where I am storing the Pedido objects coming from the method is also a List<Pedido> type, so I don't understand why the cast is failing. In theory, there would be only one item on the list (according to the
test I'm doing) but I don't think the method is returning a single object instead of a list.
It's the first time I create methods using parameters (the ? and the setter method) so I am not sure if my approach is fine. It should be according to the examples I've seen but any suggestion about this would be very appreciated.
Thanks!