BatchInsertSQL Exception

Hi,

Is it possible to insert only one record with BatchInsertSQL adapter service? When we tried got the below exception. Any suggestions please?

[ART.114.505] Error while invoking adapter service com.wm.adapter.wmjdbc.services.BatchInsert. com.wm.adk.cci.record.WmRecord cannot be cast to [Lcom.wm.adk.cci.record.WmRecord;

Even if it is one record, it should go as a array list, where array[0] holds the first record… I have not tried, but it should work… Are you trying to insert by passing document instead of document list?

Senthil

Thanks for the reply senthil. BatchInsertSQL adapter service is working successfully for single record insert. I want to handle both single and Multiple records with one BatchInsertSQL adapter service. For that I am passing document list as input to the adapter service.Its working fine for multiple records insert. When I pass single record as input to this adapter service, got the below BatchInsertSQL exception and it says, document cannot be cast to documentlist. Any inputs?

[ART.114.505] Error while invoking adapter service com.wm.adapter.wmjdbc.services.BatchInsert.
com.wm.adk.cci.record.WmRecord cannot be cast to [Lcom.wm.adk.cci.record.WmRecord;

As Senthil noted, you cannot pass a document to the service. You need to pass a list, which can consist of just one entry.

If you have single record in input which is supposed to be a list, & if you dont provide a schema or doc type name while using documentToXMLString service, the output will be a single document

If you have single record in input, and if you provide schema or doc type name, the output of will be a document list with array[0]

You have to consider the second way of coding in your case…

HTH
Senthil