I traced the problem all the way to the database, really. It seems like the only way to avoid it through JPA, other than writing manual insert/update queries, is to perform a full analysis on the query and get the column from a type in the metamodel. I talked to the Postgre people and they seem to be fine with having 50 NULL types, instead of just having it be a special value, as it's supposed to be. They type-check it against the type that the JDBC driver tells them before they check if it's a NULL. Short version: the problem is not in Hibernate. You should close the issue and maybe just document it somewhere that under Postgres, native queries cannot reliably accept null values. |