1 package liquibase.database.jvm;
2
3 import liquibase.exception.DatabaseException;
4
5 import java.sql.Connection;
6 import java.sql.SQLException;
7 import java.sql.Statement;
8
9 public class DerbyConnection extends JdbcConnection {
10
11 public DerbyConnection(Connection connection) {
12 super(connection);
13 }
14
15 @Override
16 public void commit() throws DatabaseException {
17 super.commit();
18
19 checkPoint();
20 }
21
22 @Override
23 public void rollback() throws DatabaseException {
24 super.rollback();
25
26 checkPoint();
27 }
28
29 private void checkPoint() throws DatabaseException {
30 Statement st = null;
31 try {
32 st = createStatement();
33 st.execute("CALL SYSCS_UTIL.SYSCS_CHECKPOINT_DATABASE()");
34 } catch (SQLException e) {
35 throw new DatabaseException(e);
36 } finally {
37 if (st != null) {
38 try {
39 st.close();
40 } catch (SQLException e) {
41
42 }
43 }
44 }
45 }
46 }