@Transactional(rollbackFor = Throwable.class)
  @Override
  public void saveOrUpdateRecords(ArchivedInferredLocationRecord... records) {
    List<ArchivedInferredLocationRecord> list =
        new ArrayList<ArchivedInferredLocationRecord>(records.length);
    for (ArchivedInferredLocationRecord record : records) list.add(record);
    _template.saveOrUpdateAll(list);

    // LastKnownRecord
    LinkedHashMap<Integer, CcAndInferredLocationRecord> lastKnownRecords =
        new LinkedHashMap<Integer, CcAndInferredLocationRecord>(records.length);
    for (ArchivedInferredLocationRecord record : records) {
      CcLocationReportRecord cc = findRealtimeRecord(record);
      if (cc != null) {
        CcAndInferredLocationRecord lastKnown = new CcAndInferredLocationRecord(record, cc);
        if (validationService.validateLastKnownRecord(lastKnown)) {
          lastKnownRecords.put(lastKnown.getVehicleId(), lastKnown);
        } else {
          discardRecord(lastKnown);
        }
      }
    }
    _template.saveOrUpdateAll(lastKnownRecords.values());
    _template.flush();
    _template.clear();
  }
Ejemplo n.º 2
0
 public void saveDetails(Object target, HibernateTemplate ht) throws Exception {
   for (PropertyDescriptor pd : listProps) {
     List list = (List) pd.getReadMethod().invoke(target);
     if (list != null) {
       ht.saveOrUpdateAll(list);
     }
   }
 }
 @Transactional(readOnly = false)
 public void saveStats(List<Stat> listS) {
   hibernateTemplate.saveOrUpdateAll(listS);
 }
 @Transactional(readOnly = false)
 public void saveStatCategories(List<StatCategory> listSC) {
   hibernateTemplate.saveOrUpdateAll(listSC);
 }
Ejemplo n.º 5
0
 @Override
 public void importAll(List<Goodsinfo> goodsinfos) {
   // TODO Auto-generated method stub
   mysqlhibernateTemplete.saveOrUpdateAll(goodsinfos);
 }