The Basic Operations

When you have create a new Persistence Manager in you application, you can use this component to insert, update, delete and retrieve objects. The class 'Folder' used in the following sections should be associated to a class-descriptor defined in the mapping descriptor.

This page describes only the main Persistence Manager methods. You can see the javadoc to get more information on the API.

Insert

Folder folder =  new Folder();
folder.setPath("/myfolder");
folder.set...(); // call the setter methods

persistenceManager.insert(myFolder);
					

Retrieve and update an object

Folder folder = (Folder) persistenceManager.getObject(Folder.class, "/myfolder");
folder.set...(); // call the setter methods

persistenceManager.update(myFolder);
	

Delete

			
persistenceManager.remove("/test");

Save last changes

After some inserts, deletes and/or updates, you can call the method persistenceManager.save() to apply your changes into the JCR repository.