Update Security


#1

I was trying change an EquitySecurity field value using the following piece of code.

SecuritySearchRequest request = new SecuritySearchRequest();
request.addExternalId(ExternalId.of(ExternalScheme.of("ticker"), "AAPL"));
SecuritySearchResult result = _securityMaster.search(request);
for (SecurityDocument doc:result.getDocuments()) {
  EquitySecurity equitySec = (EquitySecurity) doc.getObject();
  equitySec.setShortName("APPLE INC1");
  doc.setObject(equitySec);
  _securityMaster.update(doc);
}

I got the error https://gist.github.com/4248905

surprisingly I found that the field value has changed on the run. May I know what the errror indicates?

is there a better way to change the field of a equitySecurity object?


#2

This is an error in the EHCaching of securities - the security master notifies registered security sources so they can invalidate or update cached copies. I took a look at the current develop branch and the logic seems to have changed. I’ve filed a JIRA to investigate if this still happens on the current version.