1 package dinamica; 2 3 import javax.sql.*; 4 import java.sql.*; 5 6 19 public class MasterDetailReader extends GenericTransaction 20 { 21 22 25 public int service(Recordset inputParams) throws Throwable 26 { 27 28 int rc = 0; 29 30 super.service(inputParams); 32 33 Db db = getDb(); 36 String sql = getResource(getConfig().getConfigValue("query-master")); 37 sql = getSQL(sql, inputParams); 38 Recordset rs = db.get(sql); 39 publish("master", rs); 40 41 return rc; 42 43 } 44 45 51 public Recordset getDetail(Recordset master) throws Throwable 52 { 53 54 DataSource ds = getDataSource(); 56 Connection conn = ds.getConnection(); 57 this.setConnection(conn); 58 59 try 60 { 61 62 Db db = getDb(); 64 65 String sql = getResource(getConfig().getConfigValue("query-detail")); 67 sql = getSQL(sql, master); 68 69 Recordset items = db.get(sql); 71 72 return items; 73 74 } 75 catch (Throwable e) 76 { 77 throw e; 78 } 79 finally 80 { 81 if (conn!=null) 82 conn.close(); 83 } 84 85 } 86 87 } 88 | Popular Tags |