Skip to content

Commit

Permalink
Add BigDecimal -> Double conversion (#37)
Browse files Browse the repository at this point in the history
Fixes #36
  • Loading branch information
NicolaIsotta authored and brettwooldridge committed Dec 3, 2018
1 parent bfb16aa commit ab22721
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ However, if the Java object type returned by the driver *does not match* the typ
| ``java.math.BigDecimal`` | ``java.math.BigInteger`` |
| ``java.math.BigDecimal`` | ``int`` or ``java.lang.Integer`` (via cast) |
| ``java.math.BigDecimal`` | ``long`` or ``java.lang.Long`` (via cast) |
| ``java.math.BigDecimal`` | ``double`` or ``java.lang.Double`` (via cast) |
| ``java.util.UUID`` | ``String`` |
| ``java.sql.Clob`` | ``String`` |

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/zaxxer/sansorm/internal/Introspected.java
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ else if (fieldType == Integer.class) {
else if (fieldType == Long.class) {
columnValue = ((BigDecimal) columnValue).longValue();
}
else if (fieldType == Double.class) {
columnValue = ((BigDecimal) columnValue).doubleValue();
}
}
else if (columnType == java.util.UUID.class && fieldType == String.class) {
columnValue = columnValue.toString();
Expand Down

0 comments on commit ab22721

Please sign in to comment.