Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to update clobDomain column

Baji ShaikFeb 9 2012 — edited Feb 10 2012
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 9 2012
Added on Feb 9 2012
4 comments
234 views