I'm using a PostgreSQL DB and I would like to start VACUUM FULL
using JPA EntityManager.
Version 1
public void doVacuum(){
entityManager.createNativeQuery("VACUUM FULL").executeUpdate()
}
throws TransactionRequiredException
Version 2
@Transactional
public void doVacuum(){
entityManager.createNativeQuery("VACUUM FULL").executeUpdate()
}
throws PersistenceException "VACUUM cannot run inside a transaction block"
Version 3
public void doVacuum(){
entityManager.createNativeQuery("VACUUM FULL").getResultList()
}
vacuum is performed but after that I get PersistenceException "No results"
What is the correct way to start this sql command?