micha
micha

Reputation: 49582

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
}

My questions are:

(Unfortunately the Jackrabbit OCM documentation is not really detailed)

Upvotes: 1

Views: 1184

Answers (1)

Kenji Nakamura
Kenji Nakamura

Reputation: 56

For lazy loading, you can achieve this by specifying proxy=true in Bean or Collection annotation.

Binary data can be represented as jcr:data property of nt:resource so the mapping looks something like this.

@Node(jcrType = "nt:resource")
public class ResourceModel extends MimeTypeModel {

    @Field(path = true)
    String path = null;

    @Field(jcrName = "jcr:data")
    java.io.InputStream jcr_data = null;
}

It is true the document of OCM is not updated, but you can find the useful information from /org/apache/jackrabbit/ocm/config/jackrabbit-ocm-1.5.dtd under src/main/resources in the source distribution.

HTH,

Upvotes: 4

Related Questions