Skip to content

Commit 0d413c7

Browse files
committed
reverted schema update implementation for Hibernate 3.2 compatibility (SPR-6509)
1 parent 604a9f0 commit 0d413c7

File tree

1 file changed

+13
-23
lines changed

1 file changed

+13
-23
lines changed

org.springframework.orm/src/main/java/org/springframework/orm/hibernate3/LocalSessionFactoryBean.java

+13-23
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import org.hibernate.dialect.Dialect;
4141
import org.hibernate.engine.FilterDefinition;
4242
import org.hibernate.event.EventListeners;
43-
import org.hibernate.jdbc.Work;
4443
import org.hibernate.tool.hbm2ddl.DatabaseMetadata;
4544
import org.hibernate.transaction.JTATransactionFactory;
4645

@@ -936,13 +935,10 @@ public void dropDatabaseSchema() throws DataAccessException {
936935
hibernateTemplate.execute(
937936
new HibernateCallback<Object>() {
938937
public Object doInHibernate(Session session) throws HibernateException, SQLException {
939-
session.doWork(new Work() {
940-
public void execute(Connection connection) throws SQLException {
941-
Dialect dialect = Dialect.getDialect(getConfiguration().getProperties());
942-
String[] sql = getConfiguration().generateDropSchemaScript(dialect);
943-
executeSchemaScript(connection, sql);
944-
}
945-
});
938+
Connection con = session.connection();
939+
Dialect dialect = Dialect.getDialect(getConfiguration().getProperties());
940+
String[] sql = getConfiguration().generateDropSchemaScript(dialect);
941+
executeSchemaScript(con, sql);
946942
return null;
947943
}
948944
}
@@ -968,13 +964,10 @@ public void createDatabaseSchema() throws DataAccessException {
968964
hibernateTemplate.execute(
969965
new HibernateCallback<Object>() {
970966
public Object doInHibernate(Session session) throws HibernateException, SQLException {
971-
session.doWork(new Work() {
972-
public void execute(Connection connection) throws SQLException {
973-
Dialect dialect = Dialect.getDialect(getConfiguration().getProperties());
974-
String[] sql = getConfiguration().generateSchemaCreationScript(dialect);
975-
executeSchemaScript(connection, sql);
976-
}
977-
});
967+
Connection con = session.connection();
968+
Dialect dialect = Dialect.getDialect(getConfiguration().getProperties());
969+
String[] sql = getConfiguration().generateSchemaCreationScript(dialect);
970+
executeSchemaScript(con, sql);
978971
return null;
979972
}
980973
}
@@ -1003,14 +996,11 @@ public void updateDatabaseSchema() throws DataAccessException {
1003996
hibernateTemplate.execute(
1004997
new HibernateCallback<Object>() {
1005998
public Object doInHibernate(Session session) throws HibernateException, SQLException {
1006-
session.doWork(new Work() {
1007-
public void execute(Connection connection) throws SQLException {
1008-
Dialect dialect = Dialect.getDialect(getConfiguration().getProperties());
1009-
DatabaseMetadata metadata = new DatabaseMetadata(connection, dialect);
1010-
String[] sql = getConfiguration().generateSchemaUpdateScript(dialect, metadata);
1011-
executeSchemaScript(connection, sql);
1012-
}
1013-
});
999+
Connection con = session.connection();
1000+
Dialect dialect = Dialect.getDialect(getConfiguration().getProperties());
1001+
DatabaseMetadata metadata = new DatabaseMetadata(con, dialect);
1002+
String[] sql = getConfiguration().generateSchemaUpdateScript(dialect, metadata);
1003+
executeSchemaScript(con, sql);
10141004
return null;
10151005
}
10161006
}

0 commit comments

Comments
 (0)