0

I am using hibernate-generic-dao for a searching function. Since I only need to show one of the records if they have same value on a column field. But I am not sure how to achieve this by the search / filter functions.

package com.googlecode.genericdao.search;
PersonContact domain object:
...
@Column(name = "group_key", length = 20)
    public String getGroupKey() {
        return groupKey;
    }

@Formula(value = "(SELECT status from person_contact m " + 
                " WHERE m.case = case AND m.movement_id = movement_id )")    
    public String getActiveRecord() {
        return activeRecord;
    }
...
Search search = new Search();
search.addFilterNotNull("groupKey"); //groupKey is the field I want to use "group by / unqiue" with it
search.addFilterEqual("type","C");
search.addFilterCustom("{activeRecord} != 'I' ");
search.setMaxResults(limit);//for paging
search.setFirstResult(startIdx);
SearchResult<PersonContact> resultObj = PersonContactDAO.searchAndCount(search);
azrael3192
  • 37
  • 1
  • 5

1 Answers1

0

You should probably ask this question by opening an issue in the repository for that project here: https://github.com/vincentruan/hibernate-generic-dao

It seems though as if the project is abandoned, so unless you feel like digging into the details, you should probably try to get away from it.

Christian Beikov
  • 15,141
  • 2
  • 32
  • 58