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

    MeetupsRegistration newMeetupsRegistration = _persistence.create(pk);

    newMeetupsRegistration.setCompanyId(RandomTestUtil.nextLong());

    newMeetupsRegistration.setUserId(RandomTestUtil.nextLong());

    newMeetupsRegistration.setUserName(RandomTestUtil.randomString());

    newMeetupsRegistration.setCreateDate(RandomTestUtil.nextDate());

    newMeetupsRegistration.setModifiedDate(RandomTestUtil.nextDate());

    newMeetupsRegistration.setMeetupsEntryId(RandomTestUtil.nextLong());

    newMeetupsRegistration.setStatus(RandomTestUtil.nextInt());

    newMeetupsRegistration.setComments(RandomTestUtil.randomString());

    _meetupsRegistrations.add(_persistence.update(newMeetupsRegistration));

    MeetupsRegistration existingMeetupsRegistration =
        _persistence.findByPrimaryKey(newMeetupsRegistration.getPrimaryKey());

    Assert.assertEquals(
        existingMeetupsRegistration.getMeetupsRegistrationId(),
        newMeetupsRegistration.getMeetupsRegistrationId());
    Assert.assertEquals(
        existingMeetupsRegistration.getCompanyId(), newMeetupsRegistration.getCompanyId());
    Assert.assertEquals(
        existingMeetupsRegistration.getUserId(), newMeetupsRegistration.getUserId());
    Assert.assertEquals(
        existingMeetupsRegistration.getUserName(), newMeetupsRegistration.getUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingMeetupsRegistration.getCreateDate()),
        Time.getShortTimestamp(newMeetupsRegistration.getCreateDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingMeetupsRegistration.getModifiedDate()),
        Time.getShortTimestamp(newMeetupsRegistration.getModifiedDate()));
    Assert.assertEquals(
        existingMeetupsRegistration.getMeetupsEntryId(),
        newMeetupsRegistration.getMeetupsEntryId());
    Assert.assertEquals(
        existingMeetupsRegistration.getStatus(), newMeetupsRegistration.getStatus());
    Assert.assertEquals(
        existingMeetupsRegistration.getComments(), newMeetupsRegistration.getComments());
  }
  @Test
  public void testDynamicQueryByPrimaryKeyExisting() throws Exception {
    MeetupsRegistration newMeetupsRegistration = addMeetupsRegistration();

    DynamicQuery dynamicQuery =
        DynamicQueryFactoryUtil.forClass(MeetupsRegistration.class, _dynamicQueryClassLoader);

    dynamicQuery.add(
        RestrictionsFactoryUtil.eq(
            "meetupsRegistrationId", newMeetupsRegistration.getMeetupsRegistrationId()));

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

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

    MeetupsRegistration existingMeetupsRegistration = result.get(0);

    Assert.assertEquals(existingMeetupsRegistration, newMeetupsRegistration);
  }
  @Test
  public void testDynamicQueryByProjectionExisting() throws Exception {
    MeetupsRegistration newMeetupsRegistration = addMeetupsRegistration();

    DynamicQuery dynamicQuery =
        DynamicQueryFactoryUtil.forClass(MeetupsRegistration.class, _dynamicQueryClassLoader);

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

    Object newMeetupsRegistrationId = newMeetupsRegistration.getMeetupsRegistrationId();

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

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

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

    Object existingMeetupsRegistrationId = result.get(0);

    Assert.assertEquals(existingMeetupsRegistrationId, newMeetupsRegistrationId);
  }
 @Override
 public Long get(MeetupsRegistration meetupsRegistration) {
   return meetupsRegistration.getMeetupsRegistrationId();
 }