SAP / olingo-jpa-processor-v4

The JPA Processor fills the gap between Olingo V4 and the database, by providing a mapping between JPA metadata and OData metadata, generating queries and supporting the entity manipulations.
Apache License 2.0
122 stars 76 forks source link

Querying UUID not working concerning MariaDB #209

Open spanky440 opened 1 year ago

spanky440 commented 1 year ago

Related request URL examples:

Related JPA Setup

import java.util.UUID;
import javax.persistence.*;

@Entity
public class Entity
{
  @Id
  @Column(name = "guid", length = 36)
  @Convert(converter = UuidConverter.class)
  private UUID id = UUID.randomUUID();
}
import java.util.UUID;
import javax.persistence.*;

@Converter
public class UuidConverter implements AttributeConverter<UUID, String>
{
  @Override
  public String convertToDatabaseColumn(UUID attribute)
  {
    return attribute.toString();
  }

  @Override
  public UUID convertToEntityAttribute(String dbData)
  {
    return UUID.fromString(dbData);
  }
}

✔️ Setup is working with the in-memory H2 database. ❌ Setup is not working when using MariaDB (org.mariadb.jdbc.Driver) as datasource.

However, after debugging a couple of hours through the code base, my main question is: Why is the defined UuidConverter not respected, when building the SQL query criteria?

Since the SQL statement is native, I guess it needs database type related query arguments.

Regards