views:

36

answers:

1

Following query gives a NullPointerException when complie it.


Query query = pm.newQuery(Festival.class);
 query.setFilter("this.startDate == sDate");
 query.declareImports("import  java.util.GregorianCalendar");
 query.declareParameters("GregorianCalendar sDate");

query.compile();

Class:


 public class Festival{
   ...
   private GregorianCalendar startDate;
   ...
 }

Mapping:


   field name="startDate" persistence-modifier="persistent" 
       extension vendor-name="datanucleus" key="calendar-one-column" value="true"
    field

Exception:

[junit] java.lang.NullPointerException
[junit]  at org.datanucleus.store.mapped.mapping.GregorianCalendarMapping.addDatastoreFields(GregorianCalendarMapping.java:69)
[junit]  at org.datanucleus.store.mapped.mapping.GregorianCalendarMapping.initialize(GregorianCalendarMapping.java:64)
[junit]  at org.datanucleus.store.mapped.mapping.MappingFactory.createMapping(MappingFactory.java:66)
[junit]  at org.datanucleus.store.mapped.mapping.AbstractMappingManager.getMappingWithDatastoreMapping(AbstractMappingManager.java:102)
[junit]  at org.datanucleus.store.rdbms.query.legacy.JDOQLQueryCompiler.compileIdentifier(JDOQLQueryCompiler.java:902)
[junit]  at...................

This is run with Microsoft SQL server 2008 express edition. Is this a problem with Datanucleus or my code?

A: 

using legacy code

DataNucleus