public void testUpdateExisting() throws Exception { long pk = nextLong(); SCFrameworkVersion newSCFrameworkVersion = _persistence.create(pk); newSCFrameworkVersion.setGroupId(nextLong()); newSCFrameworkVersion.setCompanyId(nextLong()); newSCFrameworkVersion.setUserId(nextLong()); newSCFrameworkVersion.setUserName(randomString()); newSCFrameworkVersion.setCreateDate(nextDate()); newSCFrameworkVersion.setModifiedDate(nextDate()); newSCFrameworkVersion.setName(randomString()); newSCFrameworkVersion.setUrl(randomString()); newSCFrameworkVersion.setActive(randomBoolean()); newSCFrameworkVersion.setPriority(nextInt()); _persistence.update(newSCFrameworkVersion, false); SCFrameworkVersion existingSCFrameworkVersion = _persistence.findByPrimaryKey(newSCFrameworkVersion.getPrimaryKey()); assertEquals( existingSCFrameworkVersion.getFrameworkVersionId(), newSCFrameworkVersion.getFrameworkVersionId()); assertEquals(existingSCFrameworkVersion.getGroupId(), newSCFrameworkVersion.getGroupId()); assertEquals(existingSCFrameworkVersion.getCompanyId(), newSCFrameworkVersion.getCompanyId()); assertEquals(existingSCFrameworkVersion.getUserId(), newSCFrameworkVersion.getUserId()); assertEquals(existingSCFrameworkVersion.getUserName(), newSCFrameworkVersion.getUserName()); assertEquals( Time.getShortTimestamp(existingSCFrameworkVersion.getCreateDate()), Time.getShortTimestamp(newSCFrameworkVersion.getCreateDate())); assertEquals( Time.getShortTimestamp(existingSCFrameworkVersion.getModifiedDate()), Time.getShortTimestamp(newSCFrameworkVersion.getModifiedDate())); assertEquals(existingSCFrameworkVersion.getName(), newSCFrameworkVersion.getName()); assertEquals(existingSCFrameworkVersion.getUrl(), newSCFrameworkVersion.getUrl()); assertEquals(existingSCFrameworkVersion.getActive(), newSCFrameworkVersion.getActive()); assertEquals(existingSCFrameworkVersion.getPriority(), newSCFrameworkVersion.getPriority()); }
public void testDynamicQueryByPrimaryKeyExisting() throws Exception { SCFrameworkVersion newSCFrameworkVersion = addSCFrameworkVersion(); DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass( SCFrameworkVersion.class, SCFrameworkVersion.class.getClassLoader()); dynamicQuery.add( RestrictionsFactoryUtil.eq( "frameworkVersionId", newSCFrameworkVersion.getFrameworkVersionId())); List<SCFrameworkVersion> result = _persistence.findWithDynamicQuery(dynamicQuery); assertEquals(1, result.size()); SCFrameworkVersion existingSCFrameworkVersion = result.get(0); assertEquals(existingSCFrameworkVersion, newSCFrameworkVersion); }