List of usage examples for org.hibernate.boot.registry.internal StandardServiceRegistryImpl destroy
@Override public synchronized void destroy()
From source file:com.zutubi.pulse.master.hibernate.SchemaRefactor.java
License:Apache License
protected Object executeWithConnection(Callback c) throws SQLException { StandardServiceRegistryImpl serviceRegistry = null; Connection connection = null; try {//ww w . j a v a 2 s. co m serviceRegistry = (StandardServiceRegistryImpl) new StandardServiceRegistryBuilder() .applySettings(connectionProperties).build(); connection = serviceRegistry.getService(ConnectionProvider.class).getConnection(); conditionalBuildMappings(); return c.execute(connection); } finally { if (serviceRegistry != null) { serviceRegistry.getService(ConnectionProvider.class).closeConnection(connection); serviceRegistry.destroy(); } } }