Error executing query nxql

I am having an error when I try execute this query:

SELECT * FROM MyDocument WHERE ecm:path STARTSWITH '/domain/workspaces/1827035539688005368/documentos' AND dc:expired > DATE '17/12/2012'


javax.faces.el.EvaluationException: org.nuxeo.ecm.core.api.ClientException: Failed to execute query: java.lang.IllegalArgumentException: Invalid format: "17/12/2012" is malformed at "/12/2012" in query: SELECT * FROM dCedula WHERE ecm:path STARTSWITH '/domain/workspaces/1827035539688005368/documentos' AND dc:expired > DATE '17/12/2012'

the format is dd/MM/yyyy

complete trace:

Caused by: org.nuxeo.ecm.core.query.QueryParseException: java.lang.IllegalArgumentException: Invalid format: "17/12/2012" is malformed at "/12/2012" in query: SELECT * FROM MyDocument WHERE ecm:path STARTSWITH '/domain/workspaces/1827035539688005368/documentos' AND dc:expired > DATE '17/12/2012'
    at org.nuxeo.ecm.core.query.sql.SQLQueryParser.parse(SQLQueryParser.java:51)
    at org.nuxeo.ecm.core.storage.sql.jdbc.NXQLQueryMaker.buildQuery(NXQLQueryMaker.java:242)
    at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCMapper.query(JDBCMapper.java:731)
    at org.nuxeo.ecm.core.storage.sql.SoftRefCachingMapper.query(SoftRefCachingMapper.java:100)
    at org.nuxeo.ecm.core.storage.sql.SessionImpl.query(SessionImpl.java:1106)
    at org.nuxeo.ecm.core.storage.sql.ra.ConnectionImpl.query(ConnectionImpl.java:348)
    at org.nuxeo.ecm.core.storage.sql.coremodel.SQLSession$SQLSessionQuery.execute(SQLSession.java:581)
    at org.nuxeo.ecm.core.api.AbstractSession.query(AbstractSession.java:1512)
    ... 132 more
Caused by: org.nuxeo.ecm.core.query.QueryParseException: java.lang.IllegalArgumentException: Invalid format: "17/12/2012" is malformed at "/12/2012"
    at org.nuxeo.ecm.core.query.sql.SQLQueryParser.parse(SQLQueryParser.java:41)
    at org.nuxeo.ecm.core.query.sql.SQLQueryParser.parse(SQLQueryParser.java:47)
    ... 139 more
Caused by: java.lang.IllegalArgumentException: Invalid format: "17/12/2012" is malformed at "/12/2012"
    at org.joda.time.format.DateTimeFormatter.parseDateTime(DateTimeFormatter.java:673)
    at org.nuxeo.ecm.core.query.sql.model.DateLiteral.(DateLiteral.java:46)
    at org.nuxeo.ecm.core.query.sql.parser.CUP$parser$actions.CUP$parser$do_action(parser.java:595)
    at org.nuxeo.ecm.core.query.sql.parser.parser.do_action(parser.java:426)
    at java_cup.runtime.lr_parser.parse(lr_parser.java:569)
    at org.nuxeo.ecm.core.query.sql.SQLQueryParser.parse(SQLQueryParser.java:39)
    ... 140 more

Can I only use this format? http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html

0 votes

1 answers

931 views

ANSWER

Hi, I tested this format yyyy-MM-dd and works perfectly
12/17/2012



As you found, the only supported format for DATE in NXQL is the machine-readable yyyy-MM-dd.

1 votes