[CONJ-989] Binary column read as String Created: 2022-07-07  Updated: 2022-07-20  Resolved: 2022-07-20

Status: Closed
Project: MariaDB Connector/J
Component/s: MySQL compatibility
Affects Version/s: 3.0.5
Fix Version/s: 3.0.7

Type: Bug Priority: Major
Reporter: Loic Tosser Assignee: Diego Dupin
Resolution: Duplicate Votes: 0
Labels: None
Environment:

Spring-boot 2.7.1
Java 17
MariaDB 10.3.35


Issue Links:
Problem/Incident
is caused by CONJ-987 Version 3.0.0 returns String for VARB... Closed

 Description   

We have an issue with a byte array stored in a BINARY column.

We store a UUID in a BINARY(16) column. We convert the UUID to a byte[] before writing. We convert back from byte[] to UUID when reading.

We migrated from Spring-boot 2.6.8 to Spring-boot 2.7.1. The new 2.7.1 version comes with mariadb-java-connector:3.0.5 (with Spring-boot 2.6.X it was the 2.7.X versions).

With this new version, we have a NumberFormatException thrown when reading UUIDs from the DBs. The UUID is correctly stored as byte[], but read as String in the JDBC ResultSet.

How to reproduce

I created a repository to reproduce the issue. This repository contains a simple Entity, EntityWithUuid. There is a Spring Data JDBC repository, EntityWithUuidRepository and its related test, EntityWithUudRepositoryTest.

To reproduce the issue:

  • Launch the Mariadb service with this command:
    docker-compose up -d
  • Launch the test:
    ./gradlew test

Expected result: The test is successful.

Actual result: The test fails because of a ConversionFailedException


Generated at Thu Feb 08 03:19:47 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.