KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > transactions > SimpleQuery


1 package transactions;
2
3 import dinamica.*;
4
5 /**
6  * Sample Code: Simple Query Transaction
7  *
8  * @author YourName
9  * */

10 public class MyClass extends GenericTransaction
11 {
12
13     /* (non-Javadoc)
14      * @see dinamica.GenericTransaction#service(dinamica.Recordset)
15      */

16     public int service(Recordset inputParams) throws Throwable JavaDoc
17     {
18         
19         //reuse superclass code
20
int rc = super.service(inputParams);
21         
22         //get database object
23
Db db = getDb();
24
25         //get sql from Action directory
26
String JavaDoc sql = getResource("myquery.sql");
27         
28         //create recordsets
29
Recordset rs = db.get(sql);
30         
31         //publish recordsets to be consumed by output modules
32
publish("mydata", rs);
33         
34         //return exit-code=0 in case of success
35
return rc;
36         
37     }
38
39 }
40
Popular Tags