@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());
  }
  public void testFindByPrimaryKeyExisting() throws Exception {
    DDMStructureLink newDDMStructureLink = addDDMStructureLink();

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

    assertEquals(existingDDMStructureLink, newDDMStructureLink);
  }
  public void testCreate() throws Exception {
    long pk = nextLong();

    DDMStructureLink ddmStructureLink = _persistence.create(pk);

    assertNotNull(ddmStructureLink);

    assertEquals(ddmStructureLink.getPrimaryKey(), pk);
  }
  public void testRemove() throws Exception {
    DDMStructureLink newDDMStructureLink = addDDMStructureLink();

    _persistence.remove(newDDMStructureLink);

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

    assertNull(existingDDMStructureLink);
  }
  @Override
  public int compareTo(DDMStructureLink ddmStructureLink) {
    long primaryKey = ddmStructureLink.getPrimaryKey();

    if (getPrimaryKey() < primaryKey) {
      return -1;
    } else if (getPrimaryKey() > primaryKey) {
      return 1;
    } else {
      return 0;
    }
  }
  public void testResetOriginalValues() throws Exception {
    if (!PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
      return;
    }

    DDMStructureLink newDDMStructureLink = addDDMStructureLink();

    _persistence.clearCache();

    DDMStructureLinkModelImpl existingDDMStructureLinkModelImpl =
        (DDMStructureLinkModelImpl)
            _persistence.findByPrimaryKey(newDDMStructureLink.getPrimaryKey());

    assertEquals(
        existingDDMStructureLinkModelImpl.getClassPK(),
        existingDDMStructureLinkModelImpl.getOriginalClassPK());
  }
  @Override
  public boolean equals(Object obj) {
    if (this == obj) {
      return true;
    }

    if (!(obj instanceof DDMStructureLink)) {
      return false;
    }

    DDMStructureLink ddmStructureLink = (DDMStructureLink) obj;

    long primaryKey = ddmStructureLink.getPrimaryKey();

    if (getPrimaryKey() == primaryKey) {
      return true;
    } else {
      return false;
    }
  }