Hibernate version:
2.1.8
Mapping documents:
N.A.
Code between sessionFactory.openSession() and session.close():
N.A.
Full stack trace of any exception that occurs:
N.A.
Name and version of the database you are using:
Oracle 10g
The generated SQL (show_sql=true):
N.A.
Debug level Hibernate log excerpt:
N.A.
We are working with Hiberate and using the default c3p0 as the connection pool provider.
The problem is that we need to perform several SQL statements (alter session...) on a physical connection once it's been created (and to perform them only once).
I thought of two solutions to our problem, and can't find a way of implementing either one of them:
1. registering at c3p0 to get notified about physical connection creation, where I can perform the statements I need on the created connection.
2. whenever opening a new Hibernate Session, check if its physical connection was handled by me. If it wasn't, handle it and keep it in some static Set for next time.
I couldn't find a way of registering for events at c3p0, or to access the physical connection of a Session (using Session.connection() retrieves a connection proxy, which is new every time a new Session is opened).
Assistance on implementing any of the mentioned solutions or an alternative solution is welcomed.
Thanks,
Yoram
|