Skip to content

Commit

Permalink
fix: precision and scale
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierrick Rouxel committed Oct 2, 2024
1 parent da8ad88 commit 8464495
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,8 @@ public static AnnotationSpec getColumnAnnotation(Column column, boolean isUnique
}

if ("java.math.BigDecimal".equals(javaType)) {
columnAnnotationBuilder.addMember("precision", "$S", column.getColumnSize());
columnAnnotationBuilder.addMember("scale", "$S", column.getDecimalDigits());
columnAnnotationBuilder.addMember("precision", "$L", column.getColumnSize());
columnAnnotationBuilder.addMember("scale", "$L", column.getDecimalDigits());
}

return columnAnnotationBuilder.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public void testGetColumnAnnotationInteger() {
public void testGetColumnAnnotationBigDecimal() {
var column = Column.builder().name("AVERAGE").typeCode(2).columnSize(9).decimalDigits(2).build();
assertThat(EntityGenerator.getColumnAnnotation(column, false).toString()).isEqualTo(
"@jakarta.persistence.Column(name = \"AVERAGE\", nullable = false, unique = false, precision = \"9\", scale = \"2\")");
"@jakarta.persistence.Column(name = \"AVERAGE\", nullable = false, unique = false, precision = 9, scale = 2)");
}

private String getExample(String entityName) throws IOException, URISyntaxException {
Expand Down

0 comments on commit 8464495

Please sign in to comment.