I thought it would be good to have an API that will call any registered
queries upon connecting to the database, and maybe ones before returning it
to the connection pool.
I'm thinking it should be called in the implementations of ConnectionProvider
The basic purpose would be so you can set certain parameters. For example
in setting the timezone in PostgreSQL:
SET SESSION TIME ZONE 'UTC';
Or in MySQL:
SET SESSION time_zone = 'Europe/Berlin';
This would of course require dialect handling, and access to some of the
configuration settings given to the SessionFactory.
There should also be a way for users to customize these with a
per-persistence-unit configuration of some sort. They might want to pass
other such runtime tweaks.
Someone may want to send something like this to their MySQL:
SET SESSION sql_mode = 'TRADITIONAL,ANSI';
I realize it's too late to think about this for 6.0, but it's something to
consider for later on.