Hi, Brian.
LazyList is not sequential. In fact, this is a plain old Java List (POJL :)).
You can go up and down on this list all all day long. It is a completely disconnected from any DB connection.
This means that when you call:
List<Person> teenagers = Person.where("age > 12 and age < 19");
nothing really happens, hence the name (lazy)
However, when you try to read anything from it:
teenagers.size()
it will execute the query, generate model instances and will fill itself with those instances before returning from this call.
It means that using this method of getting data from the database for reading millions of records will crash your JVM. Use it for relatively small amount of data (as much as you can see on HTML page, for instance).
If you need to run a query to process millions of records, there is a different method:
Person.findWith(new ModelListener() {
@Override
public void onModel(Model model) {
//your code to process one model at the time
}
}, "age > 12 and age < 19");
This method of reading from DB will follow the cursor and is easy on memory
I hope it helps
tx