The best place to *find* answers to programming/development questions, imo, however it's the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but again, a great reference for *finding* answers.

My Music (Nickleus)

20130104

HibernateException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance: com.myapp.domainentitiesEJB3.member.Member.users

here's how i write my set methods in my EJB3 java entity objects when a collection is to be set and hibernate is used for persistence:

    public void setUsers(List<RbacUser> users_) {
        if (users == null) users = new ArrayList<RbacUser>();
        users.clear();
        if(users_ != null && !users_.isEmpty()) users.addAll(users_);
    }


if you try to write it like this:
    public void setUsers(List<RbacUser> users_) {
        users = users_;
    }


hibernate may give you an error like this:
HibernateException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance: com.myapp.domainentitiesEJB3.member.Member.users

No comments:

Post a Comment