Monday 21 January 2013

Persisting CQ data in the Java Content Repository

You can create an Adobe CQ application that captures data from users and stores the data in the Java Content Repository (JCR). When storing data within the JCR, each record can be saved as a separate node. A node can contain properties that store data values. 




Assume that you want to create a CQ application that tracks your customers.



When the end user fills in the CQ web form and clicks the Add Customer button, customer information is persisted in the JCR. The customer identifier value is returned and displayed in the Customer Id field. In this example, each submitted customer record is stored within a JCR node. The values, such as first name and last name, are stored as node properties, as shown in the following illustration.




This development article guides you through creating a CQ web application that captures data and stores it in the JCR. The JCR application logic is implemented as an OSGi bundle that is built using Declarative Services (DS) and Maven. DS is used to inject a SlingRepository instance into the service. The OSGi bundle is a managed component, which means that the OSGi service container creates the SlingRepository instance. 

To view this development article, click:

http://helpx.adobe.com/experience-manager/using/persisting-cq-data-java-content1.html.  

Note: If you are interesting in learning how to query the Adobe CQ JCR, click this link: http://scottsdigitalcommunity.blogspot.ca/2013/02/querying-adobe-experience-manager-data.html.

Note: If you are interested in persisting data in a relational database as opposed to the JCR, see http://scottsdigitalcommunity.blogspot.ca/2013/01/persisting-adobe-cq-data-in-relational.html

Note: When modeling data in the JCR, it is recommended that you read the following: http://dev.day.com/docs/en/cq/current/howto/model_data.html.


Join the Adobe Experience Cloud Community 

Join the Adobe Experience Cloud Community by clicking this banner




I (Scott Macdonald) am a Senior Digital Marketing Community Manager at Adobe Systems with 20 years in the high tech industry. I am also a programmer with knowledge in Java, JavaScript, C#,C++, HTML, XML and ActionScript. If  you would like to see more CQ or other Adobe Digital Marketing end to end articles like this, then leave a comment and let me know what content you would like to see.


TwitterFollow the Digital Marketing Customer Care team on Twitter @AdobeExpCare.

YouTube: Subscribe to the AEM Community Channel