Package org.dayatang.domain

Examples of org.dayatang.domain.NamedQuery


     * Test of createNamedQuery method
     */
    @Test
    public void testCreateNamedQuery() {
        String queryName = "Dictionary.findByCategory";
        NamedQuery query = repository.createNamedQuery(queryName);
        assertEquals(queryName, query.getQueryName());
    }
View Full Code Here


    /**
     * Test of find method with NamedQuery as parameter
     */
    @Test
    public void testNamedQueryFindWithArrayParameters() {
        NamedQuery query = new NamedQuery(repository, "Dictionay.findByCategoryArrayParams")
                .setParameters(gender);
        List<Dictionary> results = repository.find(query);
        assertTrue(results.contains(male));
        assertFalse(results.contains(undergraduate));
    }
View Full Code Here

    /**
     * Test of find method with NamedQuery as parameter
     */
    @Test
    public void testNamedQueryFindWithMapParameters() {
        NamedQuery query = new NamedQuery(repository, "Dictionay.findByCategory")
                .addParameter("category", gender);
        List<Dictionary> results = repository.find(query);
        assertTrue(results.contains(male));
        assertFalse(results.contains(undergraduate));
    }
View Full Code Here

    /**
     * Test of getSingleResult method with NamedQuery as parameter
     */
    @Test
    public void testNamedQueryGetSingleResult() {
        NamedQuery query = new NamedQuery(repository, "Dictionay.findByCategoryAndCode")
                .setParameters(gender, "01");
        assertEquals(male, repository.getSingleResult(query));
    }
View Full Code Here

     * Test of getSingleResult method with JpqlQuery as parameter
     */
    @Test
    public void testNamedQueryGetSingleResultCount() {
        String queryName = "DictionaryCategory.getCount";
        NamedQuery query = new NamedQuery(repository, queryName)
                .addParameter("name", "gender");
       
        assertEquals(1L, repository.getSingleResult(query));
    }
View Full Code Here

    /**
     * Test of find method with NamedQuery as parameter and scalar as result
     */
    @Test
    public void testNamedQueryScalar() {
        NamedQuery query = new NamedQuery(repository, "Dictionay.findNameAndOrder")
                .addParameter("category", gender);
        List<Object[]> results = repository.find(query);
        for (Object[] row : results) {
            System.out.println(Arrays.toString(row));
        }
View Full Code Here

     * Test of executeUpdate method with NamedQuery as parameter
     */
    @Test
    public void testNamedQueryExecuteUpdate() {
        String description = "abcd";
        NamedQuery query = new NamedQuery(repository, "Dictionay.updateDescription")
                .addParameter("description", description)
                .addParameter("category", gender);
        int count = repository.executeUpdate(query);
        assertTrue(count > 0);
        entityManager.clear();
View Full Code Here

TOP

Related Classes of org.dayatang.domain.NamedQuery

Copyright © 2018 www.massapicom. 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.