Hi,
This is the code it is working well in torque3.0 when I upgraded to
torque3.2 and upgraded to new version of village 2.0, When I try to
update the non-primary key field it is always returning error saying ,
com.workingdogs.village.DataSetException: The value for column 'xxxxx'
is a key value and cannot be updated.
Following is the example that is working under 3.0, algorithm_id is the
primary key,
public void doChange( RunData data,Context context )
throws Exception
{
Criteria criteria = new Criteria();
Criteria selectCriteria = new Criteria();
List algorithmUpdateList = null;
Algorithm algorithm = new Algorithm();
this.buildCriteria( data, context, criteria, algorithm,
selectCriteria );
IntakeTool intake = (IntakeTool) context.get("intake");
if (intake.isAllValid())
{
try
{
criteria.setSingleRecord(true);
AlgorithmPeer.doUpdate(selectCriteria, criteria);
}
catch (Exception e)
{
context.put("exceptionMessage", e.getMessage());
}
}
this.putSearchList( algorithmUpdateList, data, context);
context.put("method", "doChange");
this.setTemplate(data,"algorithm_id.vm");
}
private void buildCriteria(RunData data, Context context, Criteria
criteria, Algorithm algorithm, Criteria selectCriteria)
{
IntakeTool intake = (IntakeTool) context.get("intake");
try
{
Group algorithmIdGroup = intake.get("algorithmGroup",
IntakeTool.DEFAULT_KEY);
String algorithmId =
algorithmIdGroup.get("AlgorithmId").toString();
String algorithmDescription =
algorithmIdGroup.get("AlgorithmDescription").toString();
data.getParameters().setProperties(algorithm);
selectCriteria = buildSelectCriteria( algorithm,
selectCriteria );
if (intake.isAllValid())
{
if ((algorithmId != null) && (algorithmId.length() > 0))
criteria.add(AlgorithmPeer.ALGORITHM_ID, (Object)
algorithmId, Criteria.LIKE);
if ((algorithmDescription != null) &&
(algorithmDescription.length() > 0))
criteria.add(AlgorithmPeer.ALGORITHM_DESCRIPTION,
(Object) algorithmDescription, Criteria.LIKE);
}
else
{
context.put("exceptionMessage", "ERROR: Fields are
either missing or invalid.Please correct and resubmit.");
}
}
catch (Exception e)
{
context.put("exceptionMessage", e.getMessage());
}
}
I appreciate any help on this,
Thanks,
Neelima