1 package org.tigris.scarab.om; 2 3 48 49 import org.apache.torque.TorqueException; 51 import org.apache.torque.om.ObjectKey; 52 import org.apache.torque.util.Criteria; 53 import com.workingdogs.village.Record; 54 import com.workingdogs.village.DataSetException; 55 56 import org.tigris.scarab.services.cache.ScarabCache; 58 59 67 public class IssuePeer 68 extends org.tigris.scarab.om.BaseIssuePeer 69 { 70 private static final String ISSUE_PEER = 71 "IssuePeer"; 72 private static final String RETRIEVE_BY_PK = 73 "retrieveByPK"; 74 75 private static final String COUNT = 76 "count(" + ISSUE_ID + ')'; 77 private static final String COUNT_DISTINCT = 78 "count(DISTINCT " + ISSUE_ID + ')'; 79 80 92 public static int count(Criteria crit) 93 throws TorqueException, DataSetException 94 { 95 crit.addSelectColumn(COUNT); 96 return ((Record)IssuePeer.doSelectVillageRecords(crit).get(0)) 97 .getValue(1).asInt(); 98 } 99 100 110 public static int countDistinct(Criteria crit) 111 throws TorqueException, DataSetException 112 { 113 crit.addSelectColumn(COUNT_DISTINCT); 114 return ((Record)IssuePeer.doSelectVillageRecords(crit).get(0)) 115 .getValue(1).asInt(); 116 } 117 118 123 public static Issue retrieveByPK(ObjectKey pk) 124 throws TorqueException 125 { 126 Issue result = null; 127 Object obj = ScarabCache.get(ISSUE_PEER, RETRIEVE_BY_PK, pk); 128 if (obj == null) 129 { 130 result = BaseIssuePeer.retrieveByPK(pk); 131 ScarabCache.put(result, ISSUE_PEER, RETRIEVE_BY_PK, pk); 132 } 133 else 134 { 135 result = (Issue)obj; 136 } 137 138 result = BaseIssuePeer.retrieveByPK(pk); 139 return result; 140 } 141 } 142 | Popular Tags |