Constraint Violation Exception when trying to add node property
Hi, I have created a WCMUsePojo to handle form submissions that serve to update and/or create user profile properties found under
/home/users/../userID/profile
But am getting a Constraint Violation exception
javax.jcr.nodetype.ConstraintViolationException: No matching property definition: nodePropertyValue = thisissomestring
Even though this node is of type unstructured. I have posted my code below, any insight would be appreciated!
Thank you!
Session session = getRequest().getResourceResolver().adaptTo(Session.class);
UserManager userManager = getRequest().getResourceResolver().adaptTo(UserManager.class);
String sessionUserId = session.getUserID();
authorizablePath = userManager.getAuthorizable(sessionUserId).getPath();
String nodePropertyValue= getRequest().getParameter("nodePropertyValue");
Resource resource = getRequest().getResourceResolver().getResource(authorizablePath);
Node node = resource.adaptTo(Node.class);
Node profile = node.getNode("profile");
profile.setProperty("nodePropertyName", nodePropertyValue);
session.save();
The form is structured as such
<form method="POST" action="FormSubmission.java">
<input type="text" name="nodePropertyValue" id="nodePropertyValue" />
<button type="submit">Submit</button>
</form>