1 10 11 package com.triactive.jdo.store; 12 13 import com.triactive.jdo.FieldManager; 14 import com.triactive.jdo.PersistenceManager; 15 import java.sql.ResultSet ; 16 17 18 public class TransientIDROF implements Query.ResultObjectFactory 19 { 20 private final PersistenceManager pm; 21 private final Class candidateClass; 22 private final int[] fieldNumbers; 23 private final ColumnMapping[] fieldMappings; 24 private final int[] columnNumbersByField; 25 private final StoreManager storeMgr; 26 27 28 public TransientIDROF(PersistenceManager pm, 29 Class candidateClass, 30 int[] fieldNumbers, 31 ColumnMapping[] fieldMappings, 32 int[] columnNumbersByField) 33 { 34 this.pm = pm; 35 this.candidateClass = candidateClass; 36 this.fieldNumbers = fieldNumbers; 37 this.fieldMappings = fieldMappings; 38 this.columnNumbersByField = columnNumbersByField; 39 40 storeMgr = pm.getStoreManager(); 41 } 42 43 44 public Object getObject(ResultSet rs) 45 { 46 Object id = storeMgr.newObjectID(candidateClass); 47 48 if (fieldNumbers != null) 49 { 50 FieldManager fm = new ResultSetGetter(pm, rs, fieldMappings, columnNumbersByField); 51 52 return pm.getObjectById(id, candidateClass, fieldNumbers, fm); 53 } 54 else 55 return pm.getObjectById(id, candidateClass, false); 56 } 57 } 58 | Popular Tags |