@Test
public void testEntitiesCreatedWithIDs() throws Exception {

  List<Stage> stages = new ArrayList<Stage>();
  Stage stage = createStubStage(hostName, requestId, stageId);
  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());
  }
}