سؤال

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<>();
      }
هل كانت مفيدة؟

المحلول

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top