diff --git a/edexOsgi/com.raytheon.edex.plugin.satellite/src/com/raytheon/edex/plugin/satellite/dao/SatelliteDao.java b/edexOsgi/com.raytheon.edex.plugin.satellite/src/com/raytheon/edex/plugin/satellite/dao/SatelliteDao.java index 654fe0e666..97ad02d6a2 100644 --- a/edexOsgi/com.raytheon.edex.plugin.satellite/src/com/raytheon/edex/plugin/satellite/dao/SatelliteDao.java +++ b/edexOsgi/com.raytheon.edex.plugin.satellite/src/com/raytheon/edex/plugin/satellite/dao/SatelliteDao.java @@ -69,6 +69,7 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery; * Apr 15, 2014 4388 bsteffen Preserve fill value across interpolation levels. * Jul 07, 2015 4279 rferrel Override delete to clean up orphan entries in satellite_spatial table. * Aug 11, 2015 4673 rjpeter Remove use of executeNativeSql. + * Sep 17, 2015 4279 rferrel Do not purge the newest satellite_spatial entries. * * * @author bphillip @@ -427,7 +428,14 @@ public class SatelliteDao extends PluginDao { * Delete orphan entries in the satellite_spatial table. */ try { - this.executeSQLUpdate("delete from satellite_spatial where gid not in (select distinct coverage_gid from satellite) ;"); + /* + * Keep the newest satellite_spatial entries. May be part of a + * record not fully committed. + */ + String sqlCmd = "DELETE FROM satellite_spatial WHERE" + + "gid NOT IN (SELECT DISTINCT coverage_gid FROM satellite)" + + "AND gid < (SELECT max(gid)-25 FROM satellite_spatial) ;"; + this.executeSQLUpdate(sqlCmd); } catch (Exception e) { logger.error("Error purging orphaned satellite_spatial entries", e); }