New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MonetaryAmountType throws NullPointerException when reading a null column value #465
Comments
I don't understand the issue. There is a integration test in repository you could use to add a new test that replicates your issue. Not only that it's easier to isolate the problem that way, but, after the fix is done, there is already a test to prove the fix. |
Hi, added a test case which reproduce the error. Found out that this always happend if the salery is null. Have added this also to the test case. |
A fix could be to check the amaout value if it is not null instead of the |
Thanks @ugrave for the tests and the investigation. I'll check it out when I have some time. In the meanwhile, if you want, you could try to provide a Pull Request with a fix proposal. |
Fixed. |
The MonetaryAmountType use the ResulSet.wasNull to check for null.
Problem is that at least one getter must called before.
From javadoc og
ResultSet.wasNull
:Note that you must first call one of the getter methods on a column to try to read its value
I attached a demo with two use cases.
One read only the Money value there other one reads the hole entity.
When reading only the money value the npe is thrown. Only whan an additional column was read before it works without exception.
demo.zip
The text was updated successfully, but these errors were encountered: