Package org.dayatang.domain

Examples of org.dayatang.domain.NamedQuery


    private String queryName = "Employee.findByName";
   
    @Before
    public void setUp() {
        repository = mock(EntityRepository.class);
        instance = new NamedQuery(repository, queryName);
    }
View Full Code Here


     * 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);
        sessionFactory.getCurrentSession().clear();
View Full Code Here

        return query;
    }

    @Override
    public NamedQuery createNamedQuery(String queryName) {
        return new NamedQuery(this, queryName);
    }
View Full Code Here

    private NamedQuery query;

    public ChannelNamedQuery(EntityRepository repository, String queryName) {
        super(repository);
        Assert.notBlank(queryName, "Query name must be set!");
        query = new NamedQuery(repository, queryName);
        setQuery(query);
    }
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.