1 19 package craftsman.spy; 20 21 import java.sql.Connection ; 22 import java.sql.SQLException ; 23 24 import org.apache.commons.logging.Log; 25 import org.apache.commons.logging.LogFactory; 26 27 32 public class SpyEntity { 33 36 protected Log log = LogFactory.getLog(this.getClass().getName()); 37 38 39 42 private Connection connection = null; 43 44 45 49 public SpyEntity ( Connection c) { 50 connection = c; 51 } 52 53 54 59 public int getId() { 60 return connection!=null?(connection instanceof SpyConnection?((SpyConnection)connection).getId():connection.hashCode()):0; 61 } 62 63 64 70 public Connection getConnection() throws SQLException { 71 return connection; 72 } 73 } 74 | Popular Tags |