Hi, I am using Hibernate 3.0.1 and was wondering if anyone new of a good way to open hibernate sessions as different database users from the same sessionFactory? At the moment I am using a custom configuration class that subclasses org.hibernate.cfg.Configuration in order to provide a method, buildSessionFactory(username, password), to create session factories in order to create sessions for specific users. This seems to be working ok but I am bit concerned about the performance of creating multiple session factories (and dynamically modifying the configuration information) for each database user.
Does anyone have a better idea? I'd like to have a session factory that has an openSession(username, password) type method but have no idea about how to plug my own implementation in and get this to work. Any ideas would be greatfully received.
|