private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveButtonActionPerformed
        try {
            entityManager.getTransaction().commit();
            entityManager.getTransaction().begin();
            ViewController.getInstance().alarmUpdated();
            ViewController.getInstance().sensorUpdated();
            JOptionPane.showMessageDialog(null, "Successfully save your data.");
        } catch (RollbackException rex) {
            rex.printStackTrace();
            entityManager.getTransaction().begin();
            List<sosafe.model.SensorInfo> merged = new ArrayList<sosafe.model.SensorInfo>(list.size());
            for (sosafe.model.SensorInfo s : list) {
                merged.add(entityManager.merge(s));
            }
            list.clear();
            list.addAll(merged);
            JOptionPane.showMessageDialog(null, "Failed to save your data.");
        }
    }//GEN-LAST:event_saveButtonActionPerformed