JCR: Jackrabbit OCM - binary data and lazy loading
===

my goal is to store information about projects within Jackrabbit. Each project can consist out of several sub-projects with project related files/documents attached to them.

Consider the following structure:

    -project 1
     -project 1.1
     -project 1.2
      -project 1.2.1
      -project 1.2.2
    -project 2

I have a java class representing each project which looks like this:

    public class Project {
      
      @Field
      private String name;

      @Collection
      private List<Project> subprojects;

      // more properties + getter/setter
    }

Coming from relational databases the way JCR stores data is quite new to me and unfortunately the Jackrabbit OCM documentation is not really detailed.

My questions are:

 * Is there anything similar to lazy loading from ORM tools? For example: When i want to get the information about `project 1` i don't need all the information from subprojects. Whats the best way to achive this? An option would be to save only a list of project ids instead of the total sub projects within a project. However this does not look very comfortable to me.
 * Whats the best way to attach binary data (files, documents, images) to a project when using OCM?