ORMLite LazyForeignCollection: How to query a collection only once?

Viewed 2090

Let's assume I have the following object:

public class MyOwnList {

    @DatabaseField(id= true)
    protected int id;

    @ForeignCollectionField(eager = false)
    protected Collection<Item> items;
}

As items is marked as lazy it won't be loaded if I load the list object from the database. That's exactly what I want!!

The problem is that everytime I access items, ORMLite makes a sql query to get the collection. Only discovered it after activating the logging of ORMLite...

Why does it do that? Any good reason for that?

Is there any way that I can lazy load the collection, but only once, not everytime I access the collection? So something between eager and lazy?

1 Answers
Related