Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

sqlquery to get based on time

Hi

   i'm trying to query object based on time. but currently i'm using java.sql.Timestamp class and i try to use sqlquery to do like time < '2000-11-21' and order by date asc but both seems not to work at all by returning error below to me

com.j_spaces.core.client.sql.SQLQueryException: Failed to execute SQLQuery : [select * from com.fairex.tp.core.oms.data.Order where Order By testingDate >'2004-11-30'] at com.j_spaces.core.client.AbstractDirectSpaceProxy.executeSQLQuery(SourceFile:1317) at com.j_spaces.core.client.AbstractDirectSpaceProxy.readMultSQLTemplate(SourceFile:1482) at com.j_spaces.core.cluster.action.ClusterSpaceReadMultipleActionListener.readMultiple(SourceFile:47) at com.j_spaces.core.cluster.action.ClusterSpaceReadMultipleActionListener.onAction(SourceFile:32) at com.j_spaces.core.cluster.action.ClusterSpaceReadMultipleActionListener.onAction(SourceFile:25) at com.j_spaces.core.client.AbstractSpaceProxy.readMultiple(SourceFile:583) at com.j_spaces.core.client.AbstractSpaceProxy.readMultiple(SourceFile:572) at com.fairex.tp.core.oms.client.base.GigaSpaceClientImpl$11.call(GigaSpaceClientImpl.java:670) at com.fairex.tp.core.oms.client.base.GigaSpaceClientImpl$11.call(GigaSpaceClientImpl.java:1) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) at java.lang.Thread.run(Thread.java:619) Caused by: java.sql.SQLException: Error in statement [select * from com.fairex.tp.core.oms.data.Order where Order By testingDate >'2004-11-30'] com.j_spaces.jdbc.parser.grammar.ParseException: Encountered "Order" at line 1, column 56. Was expecting one of: "rownum" ... <identifier> ... "(" ...

at com.j_spaces.jdbc.ParserManager.handleStatement(SourceFile:133)
at com.j_spaces.core.client.AbstractDirectSpaceProxy.prepareStatement(SourceFile:1081)
at com.j_spaces.core.client.AbstractDirectSpaceProxy.executeSQLQuery(SourceFile:1201)
... 13 more

Caused by: com.j_spaces.jdbc.parser.grammar.ParseException: Encountered "Order" at line 1, column 56. Was expecting one of: "rownum" ... <identifier> ... "(" ...

at com.j_spaces.jdbc.parser.grammar.SqlParser.generateParseException(SourceFile:3169)
at com.j_spaces.jdbc.parser.grammar.SqlParser.aA(SourceFile:3043)
at com.j_spaces.jdbc.parser.grammar.SqlParser.SqlSimpleExpression(SourceFile:1467)
at com.j_spaces.jdbc.parser.grammar.SqlParser.SqlAndExpression(SourceFile:1434)
at com.j_spaces.jdbc.parser.grammar.SqlParser.SqlExpression(SourceFile:1412)
at com.j_spaces.jdbc.parser.grammar.SqlParser.selectSql(SourceFile:133)
at com.j_spaces.jdbc.parser.grammar.SqlParser.parseStatement(SourceFile:48)
at com.j_spaces.jdbc.ParserManager.handleStatement(SourceFile:98)
... 15 more

best regards

jack li h4. Attachments

[DataTime.java|/upfiles/13759714086708218.java]

[TestQuery.java|/upfiles/13759714089222818.java]

{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=2710]{quote}

asked 2008-11-16 21:22:40 -0500

jackli gravatar image

updated 2013-08-08 09:52:00 -0500

jaissefsfex gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

The attached works for me using 6.6.1.
Make sure you will not have field named "time" or "order" as part of your Space class.

Shay

Attachments

  1. DataTime.java
  2. TestQuery.java

answered 2008-11-17 11:24:45 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2008-11-16 21:22:40 -0500

Seen: 63 times

Last updated: Nov 17 '08