spkhillar / hibernate-generic-dao

Automatically exported from code.google.com/p/hibernate-generic-dao
0 stars 0 forks source link

Search Object accept a Sort Array as parameter. #60

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Would be helpful if the Search object could accept a Sort Array as 
parameter in AddSort(Sort sort).

Simple patch:

    // Sorts
    public Search addSort(Sort... sorts) {
        for(Sort sort : sorts)
        {
            SearchUtil.addSort(this, sort); 
        }
        return this;
    }

Original issue reported on code.google.com by terciofi...@gmail.com on 11 Mar 2010 at 3:57

GoogleCodeExporter commented 9 years ago
Added four new methods to SearchUtil and Search
addFetches
addFields
addFilters
addSorts

Original comment by dwolvert on 12 Mar 2010 at 4:08

GoogleCodeExporter commented 9 years ago
i have use addFetches SearchUtil.addFetches(search, "xxxx") like this .

then i got a NullPointerException, i don't know the reason about this problem.

 java.lang.NullPointerException
    at org.hibernate.hql.internal.ast.HqlSqlWalker.createFromJoinElement(HqlSqlWalker.java:407)
    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3858)
    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3644)
    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3522)
    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:706)
    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:562)
    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:299)
    at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:247)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:278)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:206)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158)
    at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:126)
    at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:88)
    at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:190)
    at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301)
    at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236)
    at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1800)
    at com.googlecode.genericdao.search.hibernate.HibernateSearchProcessor.search(HibernateSearchProcessor.java:85)
    at com.googlecode.genericdao.dao.hibernate.HibernateBaseDAO._search(HibernateBaseDAO.java:494)
    at com.googlecode.genericdao.dao.hibernate.GenericDAOImpl.search(GenericDAOImpl.java:111)

Original comment by zhuzheng...@gmail.com on 1 Jul 2014 at 4:15