This one comes up during HQL and criteria queries seldom enough to confuse the hell out of me every time I see it. However, the problem is always exactly the same thing:
You are generating your schema from your hibernate mappings, and one of your query parameters are either null or transient.
What happens is that the generated schema, with postgresql, uses bytea as the type of the foreign key when mapping collections. Describe the table that the collection gets persisted in and you'll see it. Then, Hibernate does explicit typecasting to change it to an int or bigint when you pass in a value, but when you pass in null it breaks down and you get the above error.
Subscribe to:
Post Comments (Atom)
4 comments:
So what is the solution to this problem?
The parameter to your query must be a persisted object
FYI, I just saw this issue when I passed an array instead of a collection ( like List ) as a parameter.
Thanks, you saved my day :)
Post a Comment