Ok - after consulting with the team, and seeing your recommendation, I
changed my implementation and removed PageItems from my service layer.
So that's solved for now.
Sadly, I'm still struggling to get the filters working correctly! They
work perfectly well for String fields, but the date fields I get a
type mismatch error (stack trace below). I've tried adding a
filterMatcher directly, and using the filterMatcherMap, but neither
seem to work, in spite of cribbing from your example almost verbatim.
Do I need to do anything more than this?
//add filterMatcher to tableModel
tableModel.addFilterMatcher(new MatcherKey(Date.class, "dueDate"), new
DateFilterMatcher("MM/dd/yyyy"));
...
//in the filter object that extends criteria command...
private void buildCriteria(Criteria criteria, String property, Object
value) {
if (value != null) {
criteria.add(Restrictions.like(property, "%" + value +
"%").ignoreCase());
}
}
//in the DAO -
public List<CaseDetail> getCasesWithFilterAndSort(CriteriaFilter
criteriaFilter, CriteriaSort criteriaSort, int rowStart, int rowEnd) {
List cases = (List) getHibernateTemplate().execute(new
HibernateCallback() {
public Object doInHibernate(Session session) throws
HibernateException, SQLException {
Criteria criteria =
session.createCriteria(CaseDetail.class);
criteria = criteriaFilter.execute(criteria);
criteria = criteriaSort.execute(criteria);
criteria.setFirstResult(rowStart);
criteria.setMaxResults(rowEnd - rowStart);
return criteria.list();
}
});
return cases;
}
Any thoughts, anything you can point me to as the possible issue..?
Again, thanks for all your help.
Stack Trace:
Caused by: java.lang.ClassCastException: java.lang.String
at
org.hibernate.type.descriptor.java.JdbcDateTypeDescriptor.unwrap(JdbcDateTypeDescriptor.java:
40)
at org.hibernate.type.descriptor.sql.DateTypeDescriptor
$1.doBind(DateTypeDescriptor.java:53)
at
org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:
91)
at
org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:
283)
at
org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:
278)
at org.hibernate.loader.Loader.bindPositionalParameters(Loader.java:
1873)
at org.hibernate.loader.Loader.bindParameterValues(Loader.java:1844)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:
1716)
at org.hibernate.loader.Loader.doQuery(Loader.java:801)
at
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:
274)
at org.hibernate.loader.Loader.doList(Loader.java:2542)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
at org.hibernate.loader.Loader.list(Loader.java:2271)
at
org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:
119)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1716)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)
at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:
369)
On Feb 1, 11:39 am, Jeff Johnston <
jeff.johnston...@gmail.com> wrote:
> I would for sure not implement the PageItems in your service tier. If you
> are only changing two lines there will be quite a few ways that you could
> go about abstracting that out.
>
> Glad that you like JMesa! Development starts up again in the next few
> weeks...I have some new requirements that I need to implement. I plan on
> starting by removing the deprecated methods and want to make the export
> ViewExporter more pluggable (like the rest of the framework). Then on to
> some enhancements. No breaking changes though so it will be very seamless.
>
> -Jeff
>