I need to refresh a materialized view in an Oracle database before I query the Spring Data Repository. I'm attempting to do this via a function in the Repository with a native query, like the following.
@Query("BEGIN DBMS_SNAPSHOT.REFRESH('MY_VIEW', 'C'); END;", nativeQuery = true)
fun refreshMaterializedView()
However, I am getting java.lang.NegativeArraySizeException
when calling this method, although it works fine when being run directly on the database. What am I doing wrong here? Is there an alternative way to force the materialized view to refresh?