package net.sf.nfp.mini.dao;
import java.io.IOException;
import javax.microedition.rms.RecordStore;
import javax.microedition.rms.RecordStoreException;
import net.sf.nfp.mini.data.Observation;
public class ObservationDAO extends AbstractDAO {
private RecordStore observationsRMS = null;
protected RecordStore getBaseRMS() throws RecordStoreException {
if(observationsRMS == null)
observationsRMS = RecordStore.openRecordStore("observations", true);
return observationsRMS;
}
public Observation find(int id) throws RecordStoreException, IOException {
return (Observation) super.find(id, new Observation());
}
public Observation persist(Observation observation) throws RecordStoreException, IOException {
return (Observation) super.persist(observation);
}
public void close() throws RecordStoreException {
observationsRMS.closeRecordStore();
}
public void deleteAll() throws RecordStoreException {
deleteAll(getBaseRMS());
observationsRMS = null;
}
}