Open
Description
Related request URL examples:
- /odata/v1/Entity(00b9cea8-97e9-4e8f-a097-473eef32df4d)
- /odata/v1/Entity?$filter=Id eq 00b9cea8-97e9-4e8f-a097-473eef32df4d
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?
UuidConverter
not respected due toconversionRequired == false
for all olingo supported types (includingjava.util.UUID
)
Since the SQL statement is native, I guess it needs database type related query arguments.
- ExpressionImpl.java#L353:
is:converter = Optional.ofNullable(jpaPath.get().getLeaf().getConverter());
might be:converter = Optional.ofNullable(jpaPath.get().getLeaf().getRawConverter());
Regards