protected void verify() { Session session = getSession(); // Read the object from the database Employee databaseEmployee = (Employee) session.readObject(Employee.class, getSearchExpression()); // If the employee object IS NOT in the database then there is a problem. if (databaseEmployee == null) { throw new TestErrorException( "Employee object should not have been deleted after transaction rollback"); } }
protected void resetVerify() { Session session = getSession(); // Read the object from the database Employee databaseEmployee = (Employee) session.readObject(Employee.class, getSearchExpression()); // If the employee object IS in the database then there is a problem. if (databaseEmployee != null) { throw new TestErrorException( "The example employee object should have been deleted from the database."); } }
protected void verify() { Session session = getSession(); // Read the object from the database Employee databaseEmployee = (Employee) session.readObject(Employee.class, getSearchExpression()); // If the employee object is NOT in the database then there is a problem. if (databaseEmployee == null) { throw new TestErrorException( "Employee object should have been inserted into database after commit transaction"); } // Check that the employee read from the database is the same as the one in memory. if (!compareObjects(getEmployee(), databaseEmployee)) { throw new TestErrorException( "The object read from the database, '" + databaseEmployee + "' does not match the originial, '" + getEmployee() + "."); } }
public void run() { try { counter = 0; while (!experienceError && counter < numOftries) { if (thread == 1) { session.getIdentityMapAccessor().initializeIdentityMap(BigBadObject.class); readObject = (BigBadObject) session.readObject(referenceObject); } else { readObject = (BigBadObject) session.getIdentityMapAccessor().getFromIdentityMap(referenceObject); } if ((readObject != null) && ((readObject.number02 == null) || (!readObject.number02.equals(referenceObject.number02)))) { this.experienceError = true; } counter++; } } catch (RuntimeException ex) { this.experienceError = true; this.exception = ex; } }