@Test
  public void testUpdateExisting() throws Exception {
    long pk = ServiceTestUtil.nextLong();

    DDMStructureLink newDDMStructureLink = _persistence.create(pk);

    newDDMStructureLink.setClassNameId(ServiceTestUtil.nextLong());

    newDDMStructureLink.setClassPK(ServiceTestUtil.nextLong());

    newDDMStructureLink.setStructureId(ServiceTestUtil.nextLong());

    _persistence.update(newDDMStructureLink);

    DDMStructureLink existingDDMStructureLink =
        _persistence.findByPrimaryKey(newDDMStructureLink.getPrimaryKey());

    Assert.assertEquals(
        existingDDMStructureLink.getStructureLinkId(), newDDMStructureLink.getStructureLinkId());
    Assert.assertEquals(
        existingDDMStructureLink.getClassNameId(), newDDMStructureLink.getClassNameId());
    Assert.assertEquals(existingDDMStructureLink.getClassPK(), newDDMStructureLink.getClassPK());
    Assert.assertEquals(
        existingDDMStructureLink.getStructureId(), newDDMStructureLink.getStructureId());
  }
  protected DDMStructureLink addDDMStructureLink() throws Exception {
    long pk = ServiceTestUtil.nextLong();

    DDMStructureLink ddmStructureLink = _persistence.create(pk);

    ddmStructureLink.setClassNameId(ServiceTestUtil.nextLong());

    ddmStructureLink.setClassPK(ServiceTestUtil.nextLong());

    ddmStructureLink.setStructureId(ServiceTestUtil.nextLong());

    _persistence.update(ddmStructureLink);

    return ddmStructureLink;
  }
  protected DDMStructureLink addDDMStructureLink() throws Exception {
    long pk = nextLong();

    DDMStructureLink ddmStructureLink = _persistence.create(pk);

    ddmStructureLink.setClassNameId(nextLong());

    ddmStructureLink.setClassPK(nextLong());

    ddmStructureLink.setStructureId(nextLong());

    _persistence.update(ddmStructureLink, false);

    return ddmStructureLink;
  }