AttributeConverter result ignored on extraction when ResultSet.wasNull

Description

I implemented an AttributeConverter which returned an empty string on all deserialized null values because Oracle stores null values instead of empty strings.

Although the converter gets called by BasicExtractor.extract, the result is thrown away afterwards because the result set was flagged with wasNull().

I think the bug is related to but it is more the other way round.

Environment

None

Activity

Show:
Norbert Schultz
August 8, 2014, 8:12 AM

Done.
The testcase tests that the Converter shall replace <null> with an empty String on reading from the database.

This does not happen. The converter itself is called.

Norbert Schultz
August 8, 2014, 8:35 AM

Note: also affects 4.3.6

Brett Meyer
August 8, 2014, 2:11 PM

Awesome, thank you for the test case!

Etienne Miret
August 24, 2014, 10:04 PM

Pull request that fixes this bug, as well as HHH-8697.

Warning: This PR breaks the contract for org.hibernate.type.descriptor.sql.BasicExtractor! It doesn’t check anymore for rs.wasNull(), which means subclass must return null when appropriate instead of a default value. I fixed all subclasses within hibernate-core, but I don’t know whether there are some others outside.

Gail Badner
April 15, 2015, 9:48 PM

Closing in preparation of releasing 4.3.9.Final and 4.2.19.Final.

Assignee

Steve Ebersole

Reporter

Norbert Schultz

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

Priority

Minor
Configure