com.liferay.blade.samples.jdbcservicebuilder.service.persistence.CountryPersistence.findWithDynamicQuery() - java examples

Here are the examples of the java api com.liferay.blade.samples.jdbcservicebuilder.service.persistence.CountryPersistence.findWithDynamicQuery() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

9 Examples 7

17 View Complete Implementation : CountryLocalServiceBaseImpl.java
Copyright Apache License 2.0
Author : liferay
/**
 * Performs a dynamic query on the database and returns a range of the matching rows.
 *
 * <p>
 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to <code>com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS</code> will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not <code>com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS</code>), then the query will include the default ORDER BY logic from <code>com.liferay.blade.samples.jdbcservicebuilder.model.impl.CountryModelImpl</code>. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
 * </p>
 *
 * @param dynamicQuery the dynamic query
 * @param start the lower bound of the range of model instances
 * @param end the upper bound of the range of model instances (not inclusive)
 * @return the range of matching rows
 */
@Override
public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, int end) {
    return countryPersistence.findWithDynamicQuery(dynamicQuery, start, end);
}

17 View Complete Implementation : CountryLocalServiceBaseImpl.java
Copyright Apache License 2.0
Author : liferay
/**
 * Performs a dynamic query on the database and returns the matching rows.
 *
 * @param dynamicQuery the dynamic query
 * @return the matching rows
 */
@Override
public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
    return countryPersistence.findWithDynamicQuery(dynamicQuery);
}

17 View Complete Implementation : CountryLocalServiceBaseImpl.java
Copyright Apache License 2.0
Author : liferay
/**
 * Performs a dynamic query on the database and returns an ordered range of the matching rows.
 *
 * <p>
 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to <code>com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS</code> will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not <code>com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS</code>), then the query will include the default ORDER BY logic from <code>com.liferay.blade.samples.jdbcservicebuilder.model.impl.CountryModelImpl</code>. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
 * </p>
 *
 * @param dynamicQuery the dynamic query
 * @param start the lower bound of the range of model instances
 * @param end the upper bound of the range of model instances (not inclusive)
 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
 * @return the ordered range of matching rows
 */
@Override
public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, int end, OrderByComparator<T> orderByComparator) {
    return countryPersistence.findWithDynamicQuery(dynamicQuery, start, end, orderByComparator);
}

17 View Complete Implementation : CountryLocalServiceBaseImpl.java
Copyright Apache License 2.0
Author : liferay
/**
 * Performs a dynamic query on the database and returns a range of the matching rows.
 *
 * <p>
 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.blade.samples.jdbcservicebuilder.model.impl.CountryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
 * </p>
 *
 * @param dynamicQuery the dynamic query
 * @param start the lower bound of the range of model instances
 * @param end the upper bound of the range of model instances (not inclusive)
 * @return the range of matching rows
 */
@Override
public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, int end) {
    return countryPersistence.findWithDynamicQuery(dynamicQuery, start, end);
}

17 View Complete Implementation : CountryLocalServiceBaseImpl.java
Copyright Apache License 2.0
Author : liferay
/**
 * Performs a dynamic query on the database and returns an ordered range of the matching rows.
 *
 * <p>
 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.blade.samples.jdbcservicebuilder.model.impl.CountryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
 * </p>
 *
 * @param dynamicQuery the dynamic query
 * @param start the lower bound of the range of model instances
 * @param end the upper bound of the range of model instances (not inclusive)
 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
 * @return the ordered range of matching rows
 */
@Override
public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, int end, OrderByComparator<T> orderByComparator) {
    return countryPersistence.findWithDynamicQuery(dynamicQuery, start, end, orderByComparator);
}

12 View Complete Implementation : CountryPersistenceTest.java
Copyright Apache License 2.0
Author : liferay
@Test
public void testDynamicQueryByPrimaryKeyMissing() throws Exception {
    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClreplaced(Country.clreplaced, _dynamicQueryClreplacedLoader);
    dynamicQuery.add(RestrictionsFactoryUtil.eq("countryId", RandomTestUtil.nextLong()));
    List<Country> result = _persistence.findWithDynamicQuery(dynamicQuery);
    replacedert.replacedertEquals(0, result.size());
}

12 View Complete Implementation : CountryPersistenceTest.java
Copyright Apache License 2.0
Author : liferay
@Test
public void testDynamicQueryByProjectionMissing() throws Exception {
    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClreplaced(Country.clreplaced, _dynamicQueryClreplacedLoader);
    dynamicQuery.setProjection(ProjectionFactoryUtil.property("countryId"));
    dynamicQuery.add(RestrictionsFactoryUtil.in("countryId", new Object[] { RandomTestUtil.nextLong() }));
    List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);
    replacedert.replacedertEquals(0, result.size());
}

10 View Complete Implementation : CountryPersistenceTest.java
Copyright Apache License 2.0
Author : liferay
@Test
public void testDynamicQueryByProjectionExisting() throws Exception {
    Country newCountry = addCountry();
    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClreplaced(Country.clreplaced, _dynamicQueryClreplacedLoader);
    dynamicQuery.setProjection(ProjectionFactoryUtil.property("countryId"));
    Object newCountryId = newCountry.getCountryId();
    dynamicQuery.add(RestrictionsFactoryUtil.in("countryId", new Object[] { newCountryId }));
    List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);
    replacedert.replacedertEquals(1, result.size());
    Object existingCountryId = result.get(0);
    replacedert.replacedertEquals(existingCountryId, newCountryId);
}

10 View Complete Implementation : CountryPersistenceTest.java
Copyright Apache License 2.0
Author : liferay
@Test
public void testDynamicQueryByPrimaryKeyExisting() throws Exception {
    Country newCountry = addCountry();
    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClreplaced(Country.clreplaced, _dynamicQueryClreplacedLoader);
    dynamicQuery.add(RestrictionsFactoryUtil.eq("countryId", newCountry.getCountryId()));
    List<Country> result = _persistence.findWithDynamicQuery(dynamicQuery);
    replacedert.replacedertEquals(1, result.size());
    Country existingCountry = result.get(0);
    replacedert.replacedertEquals(existingCountry, newCountry);
}