1 package org.apache.ojb.broker.accesslayer.sql; 2 3 17 18 import org.apache.ojb.broker.metadata.ClassDescriptor; 19 import org.apache.ojb.broker.metadata.FieldDescriptor; 20 import org.apache.ojb.broker.platforms.Platform; 21 import org.apache.ojb.broker.query.Criteria; 22 import org.apache.ojb.broker.query.Query; 23 import org.apache.ojb.broker.query.QueryByCriteria; 24 import org.apache.ojb.broker.util.logging.Logger; 25 26 32 33 public class SqlSelectByPkStatement extends SqlSelectStatement 34 { 35 41 public SqlSelectByPkStatement(Platform pf, ClassDescriptor cld, Logger logger) 42 { 43 super(pf, cld, buildQuery(cld), logger); 44 } 45 46 52 private static Query buildQuery(ClassDescriptor cld) 53 { 54 FieldDescriptor[] pkFields = cld.getPkFields(); 55 Criteria crit = new Criteria(); 56 57 for(int i = 0; i < pkFields.length; i++) 58 { 59 crit.addEqualTo(pkFields[i].getAttributeName(), null); 60 } 61 return new QueryByCriteria(cld.getClassOfObject(), crit); 62 } 63 } | Popular Tags |