Skip to Content
0
May 14, 2010 at 09:01 PM

Mobile 7.1 insert new record issue

27 Views

Hi

I am trying to insert a new item by selecting the header record

it is ending up with a Illegal state exception Caused by: java.sql.SQLException: Duplicate key: XXXXXX

experts could you please check this thanks !!!!

below is the code i am using to insert the item

ZkumarHeader header = (ZkumarHeader)wdContext.nodezkumar_srv().nodeget_header_asset().nodeget_header_assetOutput().getCurrentElement().model();

ZkumarItem item;

if (header.getItems().size() > 0)

{

item = (ZkumarItem)header.getItems().toArray()[0];

}

else

{

item = header.createNewItems();

}

header.addToItems(item);

wdContext.nodezkumar_srv().nodeget_item_asset().nodeget_item_assetOutput().bind(Collections.singleton(item));

wdContext.nodezkumar_srv().nodeget_item_asset().nodeget_item_assetOutput().setLeadSelection(0);

OcaRoot.getInstance().commit();