Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyOwnConnectionProvider implements ConnectionProvider {
- StandardXADataSource ds;
- public void configure(Properties properties) throws HibernateException {
- try {
- ds = new StandardXADataSource();
- ds.setDriverName((String) properties.get("hibernate.connection.driver_class"));
- ds.setTransactionManager(Current.getTransactionManager());
- ds.setUrl((String) properties.get("hibernate.connection.url"));
- ds.setUser((String) properties.get("hibernate.connection.username"));
- ds.setPassword((String) properties.get("hibernate.connection.password"));
- } catch (SQLException e) {
- throw new HibernateException(e);
- }
- }
- public Connection getConnection() throws SQLException {
- return ds.getXAConnection().getConnection();
- }
- public void closeConnection(Connection connection) throws SQLException {
- connection.close();
- }
- public void close() throws HibernateException {
- }
- public boolean supportsAggressiveRelease() {
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement