1

I would like to use Javers to audit queries other than save() and delete().

Here is my repo:

@Repository
@JaversSpringDataAuditable
public interface SomeRepo extends JpaRepository<SomeEntity, Long> {

  @JaversAuditable
  @Modifying
  @Query("Update SomeEntity ent SET ent.name = :name where ent.somePK = :somePK")
  int update someEntity(@Param("name") String name, @Param("somePK") Long somePK);

}

The error I get if I saved using that method is

Committing top-level ValueTypes like "String" is not supported. You can commit only entity or ValueObject instance

The way I've seen it done is using someRepo.getOne(somePK) and using a someRepo.save(someEntity) after modifying it with someEntity.setName("");

Are there better ways of doing it? Are there ways I can do it without changing my code?

PredictableBeaco
  • 97
  • 1
  • 1
  • 8

0 Answers0