Search in sources :

Example 1 with Region

use of com.liferay.blade.samples.jndiservicebuilder.model.Region in project liferay-blade-samples by liferay.

the class RegionPersistenceImpl method clearCache.

@Override
public void clearCache(List<Region> regions) {
    finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
    finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    for (Region region : regions) {
        entityCache.removeResult(RegionModelImpl.ENTITY_CACHE_ENABLED, RegionImpl.class, region.getPrimaryKey());
    }
}
Also used : Region(com.liferay.blade.samples.jndiservicebuilder.model.Region)

Example 2 with Region

use of com.liferay.blade.samples.jndiservicebuilder.model.Region in project liferay-blade-samples by liferay.

the class RegionPersistenceTest method testDynamicQueryByProjectionExisting.

@Test
public void testDynamicQueryByProjectionExisting() throws Exception {
    Region newRegion = addRegion();
    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Region.class, _dynamicQueryClassLoader);
    dynamicQuery.setProjection(ProjectionFactoryUtil.property("regionId"));
    Object newRegionId = newRegion.getRegionId();
    dynamicQuery.add(RestrictionsFactoryUtil.in("regionId", new Object[] { newRegionId }));
    List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);
    Assert.assertEquals(1, result.size());
    Object existingRegionId = result.get(0);
    Assert.assertEquals(existingRegionId, newRegionId);
}
Also used : DynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery) ActionableDynamicQuery(com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery) Region(com.liferay.blade.samples.jndiservicebuilder.model.Region) Test(org.junit.Test)

Example 3 with Region

use of com.liferay.blade.samples.jndiservicebuilder.model.Region in project liferay-blade-samples by liferay.

the class RegionPersistenceTest method testDynamicQueryByPrimaryKeyMissing.

@Test
public void testDynamicQueryByPrimaryKeyMissing() throws Exception {
    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Region.class, _dynamicQueryClassLoader);
    dynamicQuery.add(RestrictionsFactoryUtil.eq("regionId", RandomTestUtil.nextLong()));
    List<Region> result = _persistence.findWithDynamicQuery(dynamicQuery);
    Assert.assertEquals(0, result.size());
}
Also used : DynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery) ActionableDynamicQuery(com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery) Region(com.liferay.blade.samples.jndiservicebuilder.model.Region) Test(org.junit.Test)

Example 4 with Region

use of com.liferay.blade.samples.jndiservicebuilder.model.Region in project liferay-blade-samples by liferay.

the class RegionPersistenceTest method testRemove.

@Test
public void testRemove() throws Exception {
    Region newRegion = addRegion();
    _persistence.remove(newRegion);
    Region existingRegion = _persistence.fetchByPrimaryKey(newRegion.getPrimaryKey());
    Assert.assertNull(existingRegion);
}
Also used : Region(com.liferay.blade.samples.jndiservicebuilder.model.Region) Test(org.junit.Test)

Example 5 with Region

use of com.liferay.blade.samples.jndiservicebuilder.model.Region in project liferay-blade-samples by liferay.

the class RegionPersistenceTest method testFetchByPrimaryKeyMissing.

@Test
public void testFetchByPrimaryKeyMissing() throws Exception {
    long pk = RandomTestUtil.nextLong();
    Region missingRegion = _persistence.fetchByPrimaryKey(pk);
    Assert.assertNull(missingRegion);
}
Also used : Region(com.liferay.blade.samples.jndiservicebuilder.model.Region) Test(org.junit.Test)

Aggregations

Region (com.liferay.blade.samples.jndiservicebuilder.model.Region)23 Test (org.junit.Test)13 Serializable (java.io.Serializable)5 NoSuchRegionException (com.liferay.blade.samples.jndiservicebuilder.exception.NoSuchRegionException)4 ActionableDynamicQuery (com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery)4 Session (com.liferay.portal.kernel.dao.orm.Session)4 RegionImpl (com.liferay.blade.samples.jndiservicebuilder.model.impl.RegionImpl)3 StringBundler (com.liferay.petra.string.StringBundler)3 DynamicQuery (com.liferay.portal.kernel.dao.orm.DynamicQuery)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 Query (com.liferay.portal.kernel.dao.orm.Query)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 Function (java.util.function.Function)2 FinderPath (com.liferay.portal.kernel.dao.orm.FinderPath)1 IntegerWrapper (com.liferay.portal.kernel.util.IntegerWrapper)1 StringBundler (com.liferay.portal.kernel.util.StringBundler)1 List (java.util.List)1