Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
Hi,
i want to fetch modified object list for particular date or today.
i tried to use below Query, but it wont give me results.
please point out my mistake in below query.
any help will be grate.
=================
DateFormat dateFormat1 = new SimpleDateFormat("dd/MM/yyyy");
java.util.Date date1 = dateFormat1.parse("12/01/2015");
long time1 = date1.getTime();
Timestamp ts1= new Timestamp(time1);
criteria.appendWhere(new SearchCondition(WTPart.class,"thePersistInfo.modifyStamp", SearchCondition.EQUAL, ts1), new int[] {0});
criteria.appendAnd();
criteria.appendWhere(new SearchCondition(WTPart.class, "iterationInfo.latest", "TRUE"));
QueryResult qr= PersistenceHelper.manager.find(criteria);
System.out.println("Query Size = "+qr.size());
=======================
Regards,
Vivek
Hi Vivek,
Try passing a date range instead of a particular timestamp. You can print the criteria object to see how the query is built.
long time2 = date2.getTime();
Timestamp ts2= new Timestamp(time2);
criteria.appendWhere(new SearchCondition(WTPart.class,"thePersistInfo.modifyStamp", SearchCondition.GREATER_THAN_OR_EQUAL, ts1), new int[] {0});
criteria.appendAnd();
criteria.appendWhere(new SearchCondition(WTPart.class,"thePersistInfo.modifyStamp", SearchCondition.LESS_THAN_OR_EQUAL, ts2), new int[] {0});
Regards,
Bhushan