createNativeQuery's setParameter does not support null

Description

With table:

The following fails when using JPA 2.0 EntityManager :

It gives PostgreSQL ERROR: column "name" is of type varchar but expression is of type bytea

However using Hibernate specific Session API works:

It's also mentioned on StackOverflow: http://stackoverflow.com/questions/8211195/postgresql-jdbc-null-string-taken-as-a-bytea

Perhaps related to

Activity

Show:

Steve Ebersole November 18, 2015 at 4:16 AM

Thanks for verifying!

Yordan Gigov November 13, 2015 at 2:40 PM

Just tested it with Hibernate 5.0.2 and the bug seems to be resolved.
Sample code I used:

Parameter 4 was correctly stored as a string containing "NULL" and parameter 5 was correctly stored as an SQL NULL.

Steve Ebersole October 28, 2015 at 3:26 AM

As part of verifying that this issue affects 5.0, please just set the "Affects version". Leave the "verify-affects-5.0" label and leave the issue in "Awaiting Response" status; these are critical for us to be able to track these verifications and triage them. Thanks.

Steve Ebersole October 27, 2015 at 7:14 PM

This bug report does not indicate that the reported issue affects version 5.x. Versions prior to 5.x are no longer maintained. It would be a great help to the Hibernate team and community for someone to verify that the reported issue still affects version 5.x. If so, please add the 5.x version that you verified with to the list of affected-versions and attach the (preferably SSCCE) test case you used to do the verification to the report; from there the issues will be looked at during our triage meetings.

For details, see http://in.relation.to/2015/10/27/great-jira-cleanup-2015/

Yordan Gigov January 29, 2015 at 8:58 AM

@Cory Tucker c/o Radius: Apparently implementing the usage of java.sql.Types.NULL as a special type handling when null has special meaning in both Java and SQL is "not an appropriate way to deal with this issue". Go figure.

Out of Date

Details

Assignee

Reporter

Labels

Components

Priority

Created May 6, 2014 at 5:45 PM
Updated December 3, 2024 at 9:20 AM
Resolved November 18, 2015 at 4:16 AM
Loading...