Domanda

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<>();
      }
È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top