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

    SocialActivitySetting newSocialActivitySetting = _persistence.create(pk);

    newSocialActivitySetting.setGroupId(RandomTestUtil.nextLong());

    newSocialActivitySetting.setCompanyId(RandomTestUtil.nextLong());

    newSocialActivitySetting.setClassNameId(RandomTestUtil.nextLong());

    newSocialActivitySetting.setActivityType(RandomTestUtil.nextInt());

    newSocialActivitySetting.setName(RandomTestUtil.randomString());

    newSocialActivitySetting.setValue(RandomTestUtil.randomString());

    _persistence.update(newSocialActivitySetting);

    SocialActivitySetting existingSocialActivitySetting =
        _persistence.findByPrimaryKey(newSocialActivitySetting.getPrimaryKey());

    Assert.assertEquals(
        existingSocialActivitySetting.getActivitySettingId(),
        newSocialActivitySetting.getActivitySettingId());
    Assert.assertEquals(
        existingSocialActivitySetting.getGroupId(), newSocialActivitySetting.getGroupId());
    Assert.assertEquals(
        existingSocialActivitySetting.getCompanyId(), newSocialActivitySetting.getCompanyId());
    Assert.assertEquals(
        existingSocialActivitySetting.getClassNameId(), newSocialActivitySetting.getClassNameId());
    Assert.assertEquals(
        existingSocialActivitySetting.getActivityType(),
        newSocialActivitySetting.getActivityType());
    Assert.assertEquals(
        existingSocialActivitySetting.getName(), newSocialActivitySetting.getName());
    Assert.assertEquals(
        existingSocialActivitySetting.getValue(), newSocialActivitySetting.getValue());
  }
  @Test
  public void testDynamicQueryByPrimaryKeyExisting() throws Exception {
    SocialActivitySetting newSocialActivitySetting = addSocialActivitySetting();

    DynamicQuery dynamicQuery =
        DynamicQueryFactoryUtil.forClass(
            SocialActivitySetting.class, SocialActivitySetting.class.getClassLoader());

    dynamicQuery.add(
        RestrictionsFactoryUtil.eq(
            "activitySettingId", newSocialActivitySetting.getActivitySettingId()));

    List<SocialActivitySetting> result = _persistence.findWithDynamicQuery(dynamicQuery);

    Assert.assertEquals(1, result.size());

    SocialActivitySetting existingSocialActivitySetting = result.get(0);

    Assert.assertEquals(existingSocialActivitySetting, newSocialActivitySetting);
  }
  @Test
  public void testDynamicQueryByProjectionExisting() throws Exception {
    SocialActivitySetting newSocialActivitySetting = addSocialActivitySetting();

    DynamicQuery dynamicQuery =
        DynamicQueryFactoryUtil.forClass(
            SocialActivitySetting.class, SocialActivitySetting.class.getClassLoader());

    dynamicQuery.setProjection(ProjectionFactoryUtil.property("activitySettingId"));

    Object newActivitySettingId = newSocialActivitySetting.getActivitySettingId();

    dynamicQuery.add(
        RestrictionsFactoryUtil.in("activitySettingId", new Object[] {newActivitySettingId}));

    List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);

    Assert.assertEquals(1, result.size());

    Object existingActivitySettingId = result.get(0);

    Assert.assertEquals(existingActivitySettingId, newActivitySettingId);
  }
 @Override
 public Long get(SocialActivitySetting socialActivitySetting) {
   return socialActivitySetting.getActivitySettingId();
 }