dimanche 3 mai 2015

Hibernate Persistencebag remove element from list

I have two entities:

the first one:

    @Entity
    public class A{

    @OneToMany(mappedBy = "a", targetEntity = B.class, ...)
        @LazyCollection(LazyCollectionOption.FALSE)
        private List<B> b;

getter and setter

    }

and the second one:

@Entity
public class B{

@ManyToOne(targetEntity = A.class, ...)
    @JoinColumn(name = "aId",...)
    private A a;

now i read the data from the database and i want to remove some elements:

List<B> bList = a.getB();
for(B b: bList)
    if(some condiction)
      bList.remove(b)

why i can't? why is bList a persistanceBag and not an ArrayList? How can remove items from bList? why can i see only one item in the debug modus?

Thanks Chees

Aucun commentaire:

Enregistrer un commentaire