intellij idea - Criteria Builder - Filter a query list by "java.util.Date" NO java.sql.date -
i need query filters list date record. query must show alle record current date don't want delete in db.
ty!
ps: sorry bad english :d
public list<book> listall() throws exception { try { criteriabuilder cb = entitymanager.getcriteriabuilder(); criteriaquery<book> q = cb.createquery(book.class); root<book> c = q.from(book.class); arraylist<predicate> predicates = new arraylist<predicate>(); q.select(c).where(predicates.toarray(new predicate[]{})).orderby(cb.asc(c.get("bookdate"))); query query = entitymanager.createquery(q); list<book> list = (list<book>) query.getresultlist(); return list; } catch (exception e) { log.error("fail" + e.getmessage()); throw new exception(); } }
Comments
Post a Comment