doc1.addMixin("mix:title");
doc1.setProperty("jcr:title", "First document");
Node doc2 = root.addNode("document1", "nt:file");
doc2.addMixin("mix:lockable");
NodeImpl cont = (NodeImpl)doc2.addNode("jcr:content", "nt:resource");
cont.setProperty("jcr:mimeType", "text/plain");
cont.setProperty("jcr:lastModified", Calendar.getInstance());
cont.setProperty("jcr:encoding", "UTF-8");
cont.setProperty("jcr:data", new ByteArrayInputStream("".getBytes()));
Node doc3 = root.addNode("document2", "nt:file");
doc3.addMixin("mix:title");
doc3.setProperty("jcr:title", "Second document");
cont = (NodeImpl)doc3.addNode("jcr:content", "nt:resource");
cont.setProperty("jcr:mimeType", "text/plain");
cont.setProperty("jcr:lastModified", Calendar.getInstance());
cont.setProperty("jcr:encoding", "UTF-8");
cont.setProperty("jcr:data", new ByteArrayInputStream("".getBytes()));
session.save();
// make SQL query
QueryManager qman = this.workspace.getQueryManager();