01: package net.sourceforge.jaxor.impl;
02:
03: import net.sourceforge.jaxor.EntityChange;
04: import net.sourceforge.jaxor.api.EntityInterface;
05:
06: import java.sql.PreparedStatement;
07: import java.sql.Connection;
08: import java.sql.SQLException;
09:
10: /**
11: * Created By: Mike
12: * Date: Feb 12, 2004
13: * Time: 9:45:12 PM
14: *
15: * Last Checkin: $Author: mrettig $
16: * Date: $Date: 2004/03/07 05:06:03 $
17: * Revision: $Revision: 1.2 $
18: */
19: public class DeleteEntityChange extends EntityChange {
20:
21: public DeleteEntityChange(EntityInterface entity) {
22: super (entity);
23: }
24:
25: public DeleteEntityChange(int changeNumber, EntityInterface entity) {
26: super (changeNumber, entity);
27: }
28:
29: public PreparedStatement execute(Connection conn)
30: throws SQLException {
31: return getSqlAdapter().getDeletePreparedStatement(conn);
32: }
33:
34: public void beforeFlush() {
35: getSqlAdapter().beforeDelete();
36: }
37:
38: public void flush(Connection conn) {
39: getSqlAdapter().delete(conn);
40: }
41:
42: public void afterFlush() {
43: getSqlAdapter().afterDelete();
44: }
45:
46: public boolean isBatchable() {
47: return true;
48: }
49:
50: public void addToBatch(PreparedStatement stmt) throws SQLException {
51: getSqlAdapter().addToDeleteBatch(stmt);
52: stmt.addBatch();
53: }
54: }
|