How to update clobDomain column
Hi
We have following requirement.we have stored the xml data in clob field in the data base.we want to read that data into Document type(org.w3c.dom.Document) and add few new elements to the document and update the data back in the database.we have used the below code.
public void getPedigreeDocRec(Long pedigreeDocId ) throws Exception {
PedigreeDocumentVOImpl pedigreeDocumentRowSet = getPedigreeDocument();
String[] vcNames =
{ "byPedigreeDocumentId" };
((ViewCriteriaManager) pedigreeDocumentRowSet.getViewObject()).setApplyViewCriteriaNames(vcNames);
((PedigreeDocumentVOImpl) pedigreeDocumentRowSet.getViewObject()).setbindPedigreeDocumentId(pedigreeDocId);
pedigreeDocumentRowSet.executeQuery();
if(pedigreeDocumentRowSet != null) {
while (pedigreeDocumentRowSet.hasNext())
{
Row pedigreeDocumentRow = pedigreeDocumentRowSet.next();
ClobDomain pedigreeXML = (ClobDomain) pedigreeDocumentRow.getAttribute("PedigreeDocument");
DocumentBuilderFactory docBuildFactory= DocumentBuilderFactory.newInstance();
Document containerDoc = docBuildFactory.newDocumentBuilder().newDocument();
Node node= pedigreeXML..getXMLContentNode(containerDoc);
Element newChild = containerDoc.createElement("newNode");
node.appendChild(newChild); // i am getting error here " node type cannot be appended to node of type CDATA
String str =node.getTextContent();
}
}
this.getDBTransaction.commit();
}
Can you please let me know how can we achieve above requirement.
Thanks
Baji