Examples of JPQLQuery


Examples of org.dayatang.domain.JpqlQuery

        return results.isEmpty() ? null : results.get(0);
    }

    @Override
    public JpqlQuery createJpqlQuery(String jpql) {
        return new JpqlQuery(this, jpql);
    }
View Full Code Here

Examples of org.dayatang.domain.JpqlQuery

    private final JpqlQuery query;

    public ChannelJpqlQuery(EntityRepository repository, String jpql) {
        super(repository);
        Assert.notBlank(jpql, "JPQL must be set!");
        query = new JpqlQuery(repository, jpql);
        setQuery(query);
    }
View Full Code Here

Examples of org.dayatang.domain.JpqlQuery

     * Test of createJpqlQuery method
     */
    @Test
    public void testCreateJpqlQuery() {
        String jpql = "select o from Dictionary o";
        JpqlQuery query = repository.createJpqlQuery(jpql);
        assertEquals(jpql, query.getJpql());
    }
View Full Code Here

Examples of org.dayatang.domain.JpqlQuery

     * Test of find method with JpqlQuery as parameter
     */
    @Test
    public void testJpqlQueryFindWithArrayParameters() {
        String queryString = "select o from  Dictionary o where o.category = ?";
        JpqlQuery query = new JpqlQuery(repository, queryString)
                .setParameters(gender);
        List<Dictionary> results = repository.find(query);
        assertTrue(results.contains(male));
        assertFalse(results.contains(undergraduate));
    }
View Full Code Here

Examples of org.dayatang.domain.JpqlQuery

     * Test of find method with JpqlQuery as parameter
     */
    @Test
    public void testJpqlQueryFindWithMapParameters() {
        String queryString = "select o from  Dictionary o where o.category = :category";
        JpqlQuery query = new JpqlQuery(repository, queryString)
                .addParameter("category", gender);
        List<Dictionary> results = repository.find(query);
        assertTrue(results.contains(male));
        assertFalse(results.contains(undergraduate));
    }
View Full Code Here

Examples of org.dayatang.domain.JpqlQuery

     * Test of getSingleResult method with JpqlQuery as parameter
     */
    @Test
    public void testJpqlQueryGetSingleResult() {
        String queryString = "select o from  Dictionary o where o.category = :category and o.code = :code";
        JpqlQuery query = new JpqlQuery(repository, queryString)
                .addParameter("category", gender)
                .addParameter("code", "01");
        assertEquals(male, repository.getSingleResult(query));
    }
View Full Code Here

Examples of org.dayatang.domain.JpqlQuery

     * Test of getSingleResult method with JpqlQuery as parameter
     */
    @Test
    public void testJpqlQueryGetSingleResultCount() {
        String queryString = "select count(o) from  Dictionary o where o.category = :category and o.code = :code";
        JpqlQuery query = new JpqlQuery(repository, queryString)
                .addParameter("category", gender)
                .addParameter("code", "01");
        assertEquals(1L, repository.getSingleResult(query));
    }
View Full Code Here

Examples of org.dayatang.domain.JpqlQuery

     * Test of find method with JpqlQuery as parameter and scalar as result
     */
    @Test
    public void testJpqlQueryScalar() {
        String queryString = "select o.code, o.text from  Dictionary o where o.category = :category";
        JpqlQuery query = new JpqlQuery(repository, queryString)
                .addParameter("category", gender);
        List<Object[]> results = repository.find(query);
    }
View Full Code Here

Examples of org.dayatang.domain.JpqlQuery

     */
    @Test
    public void testJpqlQueryExecuteUpdate() {
        String description = "abcd";
        String queryString = "update Dictionary set description = :description where category = :category";
        JpqlQuery query = new JpqlQuery(repository, queryString)
                .addParameter("description", description)
                .addParameter("category", gender);
        int count = repository.executeUpdate(query);
        assertTrue(count > 0);
        entityManager.clear();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.