public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException {
        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            TObject TObject;
            try {
                TObject = em.getReference(TObject.class, id);
                TObject.getId();
            } catch (EntityNotFoundException enfe) {
                throw new NonexistentEntityException("The TObject with id " + id + " no longer exists.", enfe);
            }
            List<String> illegalOrphanMessages = null;
            List<ObjectFields> objectFieldsListOrphanCheck = TObject.getObjectFieldsList();
            for (ObjectFields objectFieldsListOrphanCheckObjectFields : objectFieldsListOrphanCheck) {
                if (illegalOrphanMessages == null) {
                    illegalOrphanMessages = new ArrayList<String>();
                }
                illegalOrphanMessages.add("This TObject (" + TObject + ") cannot be destroyed since the ObjectFields " + objectFieldsListOrphanCheckObjectFields + " in its objectFieldsList field has a non-nullable objectId field.");
            }
            if (illegalOrphanMessages != null) {
                throw new IllegalOrphanException(illegalOrphanMessages);
            }
            em.remove(TObject);
            em.getTransaction().commit();
        } finally {
            if (em != null) {
                em.close();
            }
        }
    }