In my Action Bean I load Entities from a database, use data from those Entities to create new EntityObjects using Java 8 ParallelStream, and store those EntityObjects in a List for later use on a web page.
I use the following to create these Objects using the Hibernate mapped Entities:
List<Entity> entities = dao.getEntities();
List<Object> entityObjects = new ArrayList<>();
entityObjects.addAll(
entities.parallelStream()
.map(EntityObject::new)
.collect(Collectors.toList())
);
with a EntityObject constructor looking like:
public EntityObject(Entity entity) {...}
When Trying to load the page using the Action Bean I get Hibernate Exceptions. They are different every time I try to load the page, but all have to do with Shared References, such as:
... ERROR: Found shared references to a collection
and
... ERROR: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance
What am I doing wrong?
EDIT: Fixed the code.