I'm developing a Spring REST Service (with Spring Data JPA) and my entity's contains properties of type java.util.UUID. I'm using MySQL as a database which causes problems. Everything works fine so far except repository-methods where a UUID is part of a query, e.g.: entityRepository.findByUuid(UUID uuid);
The data is stored in a binary(255)-column by default. Get the UUID from the repository works fine, the only problem is to use a UUID in queries, like in findByUuid(). It always tells me that it can't find a specific UUID in the database. The same problem happens with MariaDB.
My service works properly with H2-Database. Any idea why MySQL (and MariaDB) has this problem?
DB-Config:
spring.datasource.url=jdbc:mysql://localhost/abc123
spring.datasource.username=alfkmakfaf
spring.datasource.password=aafkmafmlaf
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.database=mysql
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
UUID in Entitys
@Entity
public class Thema {
// without any annotations, works fine with H2 Database
private UUID uuid;
...