1 Reply Latest reply on Jan 3, 2007 4:30 PM by Adam Talaat

    Sparse lazy lists?

    Peter Kaas Newbie

      I have a standard Order - OrderLine relationship whereby the OrderLines run in the thousands and they contain binary data up to about 5 MB in data per OrderLine. Obviously I don't want to page them in all at the same time.

      I have annotated my method with everything I could find:

      @OneToMany(cascade = { CascadeType.PERSIST, CascadeType.REMOVE })
      @IndexColumn(name = "index", base = 0)
       name = "order2orderlines",
       joinColumns = @JoinColumn(name="order_id"),
       inverseJoinColumns = @JoinColumn(name="order_line_id")
      public List<OrderLine> getOrderLines() {
       return orderLines;

      Everything works fairly well. getOrderLines().size() does a nice select that counts (based on the index column), getOrderLines().get(i) nicely loads up the the one item I want.

      When I try to add an item using getOrderLines().add(orderLine) however, the world comes to an end -- the whole list is paged in. Is there any way around this other than just managing the list myself through queries?

      This is with the JBoss CVS checkout of 2006-06-13 but I've been having this problem for a while now.