cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrus Adamchik (Jira)" <>
Subject [jira] [Created] (CAY-2660) Zero padding of BigDecimals causes unneeded updates
Date Fri, 05 Jun 2020 12:32:00 GMT
Andrus Adamchik created CAY-2660:

             Summary: Zero padding of BigDecimals causes unneeded updates
                 Key: CAY-2660
             Project: Cayenne
          Issue Type: Bug
    Affects Versions: 4.2.M1, 4.1.RC2, 4.0.2
            Reporter: Andrus Adamchik

Given a column mapping of "DECIMAL(N, M)" to Java BigDecimal, the following code causes an
update where it shouldn't (as there are no changes) :

// assuming the column is "DECIMAL(12, 6)"

BigDecimal bd = new BigDecimal("7890.1");

// save object

// refetch object - the result will be padded to DB scale - "7890.100000"
BigDecimalEntity o2 = ObjectSelect.query(BigDecimalEntity.class).selectFirst(runtime.newContext());

// THIS COMMIT GENERATES AN "UPDATE" SQL, where it should have been a noop

I have a PR with a fix (to be sent shortly), but it may require some discussion... 

This message was sent by Atlassian Jira

View raw message