public interface PeseeRepository extends JpaRepository<Pesee, Integer> {
...
@Query(value = "SELECT * FROM pesee FOR SYSTEM_TIME all WHERE id_pesage = ?1", nativeQuery = true)
List<Pesee> findAllPeseeHystoryById(Integer id);
...
}
Log:
Hibernate:
SELECT
*
FROM
pesee FOR SYSTEM_TIME all
WHERE
id_pesage = ?
result of the native query in my program :
raw sql exemple:
SELECT
*
FROM
pesee FOR SYSTEM_TIME all
WHERE
id_pesage = 1879;
result in raw sql:
apparently the native jpa query does not return the same result as the standard sql query.
But detects the number of rows correctly.
Here is my question: How to make mariadb table versioning work in my spring boot application? The goal is simply to return me history of a table.
CodePudding user response:
I found how to solve my problem by going through a lower level query
For the Objects to recover I called on my service in PeseeJDBC and I transmitted it to PeseeMapper Then in the PeseeMapper class I called findById from my transmitted service. (I did not add this in the example codes so as not to complicate the initial problem) It's a bit wobbly at the architectural level but it's functional