Hi. I keep getting an error, the code follows the error message. The problem seems to occur at "★★★HERE".
after "List<GCalendar> calendars = (List<GCalendar>) query.execute();" "calendars" is StreamingQueryResult object. Does the error mean that I cannot cast this object to String or Date? Could anyone help me? Thanks in advance. soichi //error message java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date at com.soichi.rainbows.GCalendar.jdoReplaceField(GCalendar.java) at com.soichi.rainbows.GCalendar.jdoReplaceFields(GCalendar.java) at org.datanucleus.state.JDOStateManagerImpl.replaceFields(JDOStateManagerImpl.java: 2772) at org.datanucleus.state.JDOStateManagerImpl.replaceFields(JDOStateManagerImpl.java: 2791) at org.datanucleus.store.appengine.DatastorePersistenceHandler.fetchObject(DatastorePersistenceHandler.java: 480) at org.datanucleus.store.appengine.query.DatastoreQuery.entityToPojo(DatastoreQuery.java: 565) at org.datanucleus.store.appengine.query.DatastoreQuery.entityToPojo(DatastoreQuery.java: 520) at org.datanucleus.store.appengine.query.DatastoreQuery.access $300(DatastoreQuery.java:110) at org.datanucleus.store.appengine.query.DatastoreQuery $6.apply(DatastoreQuery.java:638) at org.datanucleus.store.appengine.query.DatastoreQuery $6.apply(DatastoreQuery.java:630) at org.datanucleus.store.appengine.query.LazyResult.resolveNext(LazyResult.java: 94) at org.datanucleus.store.appengine.query.LazyResult.get(LazyResult.java: 81 ... //------------------------------- //a part of the code that produces the error Query query = pm.newQuery(GCalendar.class); query.setOrdering("date desc"); List<GCalendar> calendars = (List<GCalendar>) query.execute(); resp.setContentType("text/html"); resp.setCharacterEncoding("utf-8"); resp.getWriter().print(render(calendars)); //-------------------------------- private String render(List<GCalendar> calendars) { StringBuffer sb = new StringBuffer(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); sb.append(head); for (GCalendar calendar : calendars){ // ★★★HERE String tmp = sdf.format(calendar.getDate()); sb.append(MessageFormat.format(memoTmpl, tmp, calendar.getYoubi(), calendar.getTime(), calendar.getNaiyou())); } sb.append(tail); return sb.toString(); } //-------------------------------- -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.