Pregunta

So I have an object with collection. I want to lazily load it at first , but an object can be sent over a network which makes it necessary to fetch all the fields.

      @Entity   
      class Foo
      {
       @Id
       int id;
       @Column
       String name
       @OneToMany
       List<Foo2> = new ArrayList<>();
      }
¿Fue útil?

Solución

So... call a method on the list (like size() for example) to initialize it, or use Hibernate.initialize().

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top