In our use case we want to find some entity types always again very quickly by primary key or query in many short transactions.
The entity MyEntity1 and its relationships to MyEntity2/MyEntity3 was load and the entity MyEntity1 is taken in the second level cache, the other entity types not. Are the relationships to MyEntity2/MyEntity3 still always referenced although the entity manager is closed, so that the memory for MyEntity2 and MyEntity3 can never be released by garbage collector?
class MyEntity1 {
@OneToOne
private MyEntity2 myEntity2;
@OneToMany
private List<MyEntity3> list;
}