public void destroy(Long id) throws NonexistentEntityException {
        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            CustomerInfo customerInfo;
            try {
                customerInfo = em.getReference(CustomerInfo.class, id);
                customerInfo.getCustomerId();
            } catch (EntityNotFoundException enfe) {
                throw new NonexistentEntityException("The customerInfo with id " + id + " no longer exists.", enfe);
            }
            Collection<SensorInfo> sensorInfoCollection = customerInfo.getSensorInfoCollection();
            for (SensorInfo sensorInfoCollectionSensorInfo : sensorInfoCollection) {
                sensorInfoCollectionSensorInfo.setRelatedCustomerId(null);
                sensorInfoCollectionSensorInfo = em.merge(sensorInfoCollectionSensorInfo);
            }
            em.remove(customerInfo);
            em.getTransaction().commit();
        } finally {
            if (em != null) {
                em.close();
            }
        }
    }