Retirez ensuite la Requête échoue en JPA/Hibernate (supprimé entité passé à persister)

J'ai un problème avec la suppression des entités dans mon JPA application: fondamentalement, je ne dans cet EJB méthode commerciale:

load photo list ;
for each photo {
    //UPDATE
    remove TagPhoto element from @OneToMany relation
    //DISPLAY
    create query involving TagPhoto
    ...
}

et cette dernière requête jette toujours un EntityNotFoundException (supprimé entité passé à persister: [...TagPhoto#])

Je pense que je comprends le sens de cette exception, comme un problème de synchronisation causée par ma Enlever, mais comment puis-je me débarrasser de lui?

EDIT: voici la pile de l'exception:

Caused by: javax.persistence.EntityNotFoundException: deleted entity passed to persist: [net.wazari.dao.entity.TagPhoto#<null>]
    at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:621)
    at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:74)
    at net.wazari.dao.jpa.TagFacade.loadVisibleTags(TagFacade.java:108)

et la mise en correspondance entre la Balise-TagPhoto-Photo

public class Tag implements Serializable {
    ...
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tag")
    private List<TagPhoto> tagPhotoList;
}
public class TagPhoto implements Serializable {
    ...
    @JoinColumn(name = "Tag", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private Tag tag;
    @JoinColumn(name = "Photo", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private Photo photo;
}
public class Photo implements Serializable {
    ...
    @OneToMany(cascade = CascadeType.ALL , mappedBy = "photo")
    private List<TagPhoto> tagPhotoList;
}

(il a été automatiquement généré par Netbeans quand j'ai créé le projet)

EDIT: est-ce que cela signifie que tagPhoto != tagPhoto.getTag().getTagPhotoList().get(...) != tagPhoto.getPhoto().getTagPhotoList().get(...)?

et comment dois-je les supprimer? iterator.remove ne devrait pas être d'une quelconque utilité, et je pense que les trois em.remove() ferait trois fois la même opération ...

OriginalL'auteur Kevin | 2010-05-30