Hey,

I have a problem with a JPA query.
The Query get's with Date "beginn" and Date "schluss" the right
result, with "datumAnfang" and "datumEnde" an incorrect result.
I testet if the dates are equal and i think thats curious.
Debugging on my local machine the dates:

"datumAnfang" and "begin" are equal and "datumEnde" and "schluss" too,
but on the Google App Engine these dates are not equal.

Where is my fault ? Have anyone an idea ?



Here is the Code:


GregorianCalendar calendarAnfang = new GregorianCalendar();

calendarAnfang.set(GregorianCalendar.HOUR_OF_DAY, 0);
calendarAnfang.set(GregorianCalendar.MINUTE, 0);
calendarAnfang.set(GregorianCalendar.SECOND, 0);
calendarAnfang.set(GregorianCalendar.MILLISECOND, 0);

calendarAnfang.set(GregorianCalendar.YEAR, 2011);
calendarAnfang.set(GregorianCalendar.WEEK_OF_YEAR, 2);
calendarAnfang.set(GregorianCalendar.DAY_OF_WEEK,
GregorianCalendar.MONDAY);

Date datumAnfang = new Date();
datumAnfang = calendarAnfang.getTime();



GregorianCalendar calendarEnde = new GregorianCalendar();

calendarEnde.set(GregorianCalendar.HOUR_OF_DAY, 23);
calendarEnde.set(GregorianCalendar.MINUTE, 59);
calendarEnde.set(GregorianCalendar.SECOND, 59);
calendarEnde.set(GregorianCalendar.MILLISECOND, 0);

calendarEnde.set(GregorianCalendar.YEAR, 2011);
calendarEnde.set(GregorianCalendar.WEEK_OF_YEAR, 3);
calendarEnde.set(GregorianCalendar.DAY_OF_WEEK,
GregorianCalendar.SUNDAY);

Date datumEnde = new Date();
datumEnde = calendarEnde.getTime();



GregorianCalendar calAnfang = new GregorianCalendar();

calAnfang.set(GregorianCalendar.HOUR_OF_DAY, 0);
calAnfang.set(GregorianCalendar.MINUTE, 0);
calAnfang.set(GregorianCalendar.SECOND, 0);
calAnfang.set(GregorianCalendar.MILLISECOND, 0);
calAnfang.set(GregorianCalendar.YEAR, 2011);

calAnfang.set(GregorianCalendar.DAY_OF_MONTH, 10);
calAnfang.set(GregorianCalendar.MONTH, GregorianCalendar.JANUARY);

Date beginn = calAnfang.getTime();

GregorianCalendar calEnde = new GregorianCalendar();

calEnde.set(GregorianCalendar.HOUR_OF_DAY, 23);
calEnde.set(GregorianCalendar.MINUTE, 59);
calEnde.set(GregorianCalendar.SECOND, 59);
calEnde.set(GregorianCalendar.MILLISECOND, 0);

calEnde.set(GregorianCalendar.DAY_OF_MONTH, 23);
calEnde.set(GregorianCalendar.MONTH, GregorianCalendar.JANUARY);
calEnde.set(GregorianCalendar.YEAR, 2011);
Date schluss = calEnde.getTime();



EntityManager em = EMF.get().createEntityManager();

Query qAllFeiertag = em.createQuery("SELECT  FROM "
                        + Feiertag.class.getName()
                        + " WHERE datum >= :start AND datum <= :ende");


//With that parameters i get bad results
qAllFeiertag.setParameter("start", datumAnfang);
qAllFeiertag.setParameter("ende", datumEnde);


@SuppressWarnings("unchecked")
List<Feiertag> result = (List<Feiertag>) qAllFeiertag.getResultList();

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to