I'm trying to figure out a way to wrap the connection that is underlying EclipseLink and I am hoping to get some suggestions if I'm on the right track. I found a SO post that details a viable approach that uses a SessionCustomizer. This approach works for my scenario, but I'm looking for another option as a given PU can only have a single customizer.
I found that I can implement an EventListener and inject my own Connector into the DatabaseSession login. The problem with this approach is that after setting my listener I needed to log the session out and then back in so that my Connector gets called. Ie:
ServerSession ss = ((EntityManagerFactoryImpl)emf).getServerSession();
This approach seems wasteful at best. My fear is that the logout/login calls has some other side effect that I'm unaware of.