@Test
  public void testEntitiesCreatedWithIDs() throws Exception {
    List<Stage> stages = new ArrayList<>();
    Stage stage = createStubStage(hostName, requestId, stageId, false);

    stages.add(stage);

    Request request = new Request(stages, "", clusters);

    // persist entities
    db.persistActions(request);

    // query entities immediately to ensure IDs are populated
    List<HostRoleCommandEntity> commandEntities = hostRoleCommandDAO.findByRequest(requestId);
    Assert.assertEquals(2, commandEntities.size());

    for (HostRoleCommandEntity entity : commandEntities) {
      Assert.assertEquals(Long.valueOf(requestId), entity.getRequestId());
      Assert.assertEquals(Long.valueOf(stageId), entity.getStageId());
    }
  }
Tests that entities created int he {@link ActionDBAccessor} can be
retrieved with their IDs intact. EclipseLink seems to execute the
{@link NamedQuery} but then use its cached entities to fill in the data.

@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionDBAccessorImpl.java