sql - Apache ignite filtering query by date -


in cache class have factordate joda datetime object

@querysqlfield(index = true) private datetime factordate; 

i need results between 2 dates. achieve have following code:

    cacheconfiguration<integer, myclass> cfg = new cacheconfiguration<>("mycache");     cfg.setindexedtypes(integer.class, myclass.class);      igniteconfiguration ignitionconfig = new igniteconfiguration();     ignitionconfig.setcacheconfiguration(cfg);     ignite ignite = ignition.getorstart(ignitionconfig);      ignitecache<integer, myclass> cache = ignite.getorcreatecache(cfg);      datetime startdateobj = datetimeformat.forpattern("dd-mmm-yyyy").parsedatetime(startdate);     datetime enddateobj = datetimeformat.forpattern("dd-mmm-yyyy").parsedatetime(enddate);      timestamp starttimestamp = new timestamp(startdateobj.getmillis());     timestamp endtimestamp = new timestamp(enddateobj.getmillis());      stringbuilder builder = new stringbuilder();     builder.append(" select factordate, name myclass ");     builder.append(" factordate >= ? , factordate <= ? ");     builder.append(" , name = ? ");      sqlfieldsquery qry = new sqlfieldsquery(builder.tostring());      qry.setargs(starttimestamp, endtimestamp, "jack jones");     list<list<?>> res = cache.query(qry).getall(); 

i no results when know there results. ideas?

i have tried using datetime object instead of timestamp query argument still no luck

default binary format doesn't support custom comparable classes. workaround can try use optimizedmarshaller instead:

<property name="marshaller">     <bean class="org.apache.ignite.marshaller.optimized.optimizedmarshaller"/> </property> 

but note deserialize keys , values on server nodes, have make sure classes deployed there.


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -