DataNucleus JIRA is now in read-only mode. Raise any new issues in GitHub against the plugin that it applies to. DataNucleus JIRA will remain for the foreseeable future but will eventually be discontinued
Issue Details (XML | Word | Printable)

Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: Danny van Leiden
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
DataNucleus Types : JodaTime

JodaIntervalMapping null check unreachable when storing interval in two timestamp columns

Created: 06/Jun/12 10:03 AM   Updated: 06/Jun/12 12:28 PM   Resolved: 06/Jun/12 12:25 PM
Component/s: None
Affects Version/s: 3.0.1, 3.1.0.m1
Fix Version/s: 3.1.0.m2

File Attachments: 1. Text File (2 kB)

Datastore: PostgreSQL
Severity: Production

 Description  « Hide
When persisting an object with an Interval field stored in two timestamp columns, if the field contains a null value, only the first column is set to null.
This results in a failure to execute the SQL insert query, due to a missing parameter.

In my case, this results in the following exception:
org.postgresql.util.PSQLException: No value specified for parameter 16.

I've traced this back to
A null check is performed on the 'value' parameter, making the later null check on the 'interval' variable unreachable.
This results in only one 'null' object to be added to the datastore mapping, instead of two.

Sort Order: Ascending order - Click to sort in descending order
Danny van Leiden added a comment - 06/Jun/12 10:04 AM
Patch for trunk attached.

Andy Jefferson added a comment - 06/Jun/12 12:25 PM
In SVN trunk, along with a test. Thx