I have an Avro schema with some fields defined as decimal logical type. From that schema I generate classes using avro-maven-plugin (using version 1.9.0). I would like to avoid generating ByteBuffer type and use BigDecimal instead.
I found in older questions (like here) to use version 1.8.2. I tried that and then upraged to 1.9.0 and still can't get proper datatype.
Schema:
{
"name": "TUR_ID",
"type": [
"null",
"bytes"
],
"default": null,
"logicalType": "decimal",
"precision": 16,
"scale": 0
}
Plugin config in pom.xml:
<plugin>
<groupId>org.apache.avro</groupId>
<artifactId>avro-maven-plugin</artifactId>
<version>${avro.version}</version>
<executions>
<execution>
<id>schemas</id>
<phase>generate-sources</phase>
<goals>
<goal>schema</goal>
<goal>protocol</goal>
<goal>idl-protocol</goal>
</goals>
<configuration>
<stringType>String</stringType>
<enableDecimalLogicalType>true</enableDecimalLogicalType>
<sourceDirectory>${project.basedir}/src/main/resources/</sourceDirectory>
</configuration>
</execution>
</executions>
</plugin>
The actual output is @Deprecated public java.nio.ByteBuffer TUR_ID;
and I would like to get @Deprecated public java.math.BigDecimal TUR_ID;
.