1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package olr.samples;
18
19 import java.util.List;
20
21 import olr.Olr;
22 import olr.om.RdfGroup;
23 import olr.om.RdfGroupPeer;
24
25 import org.apache.torque.util.Criteria;
26
27 /***
28 * Example showing a simple query using the Torque Criteria class.
29 * @version $Id: CriteriaSample.java,v 1.4 2004/08/02 18:36:43 roku Exp $
30 */
31 public class CriteriaSample
32 {
33 public static void main(String[] args)
34 {
35 try
36 {
37 Olr.initTorque();
38 Criteria criteria = new Criteria();
39 criteria.add(RdfGroupPeer.NAME, "Administrator");
40 List groups = RdfGroupPeer.doSelect(criteria);
41
42 assert(groups.size() == 1);
43
44 RdfGroup group = (RdfGroup)groups.get(0);
45
46 System.out.println("Selected group "
47 + group.getName()
48 + " with id="
49 + group.getId());
50 }
51 catch(Exception e)
52 {
53 e.printStackTrace();
54 }
55 }
56 }