I audit changes to a com.example.TaskSupplier
entity with Javers by annotating the corresponding Spring Data repository
@JaversSpringDataAuditable public interface TaskSupplierRepository extends CrudRepository<TaskSupplier, String> { }
The primary key of this entity is a UUID, so I can retrieve an instance with
select * from task_supplier where id = 'f463d538-ceb0-498b-a20b-2bb65286d200';
However, the entry in Javers’ jv_global_id
table for this instance wraps the ID in quotes, so in order to retrieve the corresponding row from this table, I have to execute
select * from jv_global_id where type_name = 'com.sourcespace.bidsengine.model.TaskSupplier' and local_id = '"f463d538-ceb0-498b-a20b-2bb65286d200"';
Is this intentional or a bug? I was confused when the query above without the quotes was failing to retrieve anything. I’m using Postgres, Javers 5.14.0, and Spring Boot 2.4.2
Advertisement
Answer
This is intentional, it’s a JSON type and not a String type. Local Id can be any type in Java, also a Value Object, so it’s serialized to JSON.