How do I add new values using QuerySpec?
Hi, everybody.I found an example (
But I can't figure out how I can add new values ( a new row in the table) in this way .
Please tell me how this can be done?
Here is an example from the link https://community.ptc.com/t5/Windchill/Updating-user-details-in-Windchill/m-p/267772
try {
QuerySpec qs = new QuerySpec(WTUser.class);
qs.appendWhere(new SearchCondition(WTUser.class, WTUser.EMAIL,
SearchCondition.LIKE, "oldemail@oldemail.com", true), null);
QueryResult qr = PersistenceHelper.manager.find((StatementSpec) qs);
while (qr.hasMoreElements()) {
WTUser user = (WTUser)qr.nextElement();
user.setEMail("someone@something.com");
PersistenceHelper.manager.save(user);
}
} catch (WTException | WTPropertyVetoException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

