After setting up Hikari to our Grails Application (as described here ), I had to find out by observation that the hibernate behavior changed suddenly when using onAfterSave in a Gorm Domain Object:
org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not execute statement; SQL [n/a]; ERROR: insert or update on table "xxx" violates foreign key constraint "FK_9rkehgw2fq54vy4o8yw6xqd1u"
Detail: Key (attribution_id)=(1013967) is not present in table "attribution".; nested exception is org.postgresql.util.PSQLException: ERROR: insert or update on table "xxx" violates foreign key constraint "FK_9rkehgw2fq54vy4o8yw6xqd1u"
where (as you can see) the referenced object has an id (1013967) so the saving transaction should be commmited and there should be no violation. Removing Hikari fixed this behavior again.
I assume this has todo with Transaction Isolation and /or autocommit settings; however why does the behavior change when the pool manager is changed from Tomcat to Hikari?
What settings are to be made to restore original Grails behavior?
Thank you