protected void test() { UnitOfWork uow = getSession().acquireUnitOfWork(); ReadObjectQuery query = new ReadObjectQuery(Employee.class); query.setLockMode(ObjectLevelReadQuery.LOCK_NOWAIT); Employee emp = (Employee) uow.executeQuery(query); emp.setSalary(emp.getSalary() + 1); uow.commit(); }
public void test() { ReadObjectQuery query = new ReadObjectQuery(); query.setReferenceClass(Employee.class); query.setExampleObject(employee); query.setQueryByExamplePolicy(policy); Employee emp = new Employee(); emp = (Employee) getSession().executeQuery(query); if (!(emp.getFirstName().charAt(0) == 'J') && (emp.getFirstName().charAt(3) == 'l') && (emp.getLastName().charAt(0) == 'M')) { throw (new TestErrorException("Error in using specail operators.")); } if (!(emp.getSalary() < 60000)) { throw (new TestErrorException("Error is using spcial operators.")); } }