Hi!
I am facing with a very weird behaviour of a select statement.
I cannot execute expand() or contains() function because a 
ClassCastException is raised or no records at all are returned.

I have a "games" class that for out test, at the moment contains just one 
record:
            "@rid": "#24:0",
            "@version": 2,
            "@class": "games",
            "players": [
                {
                    "username": "[email protected]",
                    "name": "john doe",
                    "points": 0
                },
                {
                    "username": "[email protected]",
                    "name": "jane doe",
                    "department": "one",
                    "points": 0
                },
                {
                    "username": "[email protected]",
                    "name": "dana scully",
                    "department": "two",
                    "points": 0
                }
            ],
            "status": "open",
            "player_turn": 0,
            "id": "ff342a9b-79cd-4494-983e-6ec4a1a47c8a",
            "_creation_date": "2014-02-15T13:49:51.051+0100",
            "_author": "admin"

As you can see the field "players" is a collection of JSON objects.
If I perform a query against the class I have:
orientdb> select from games
----+-----+-------+------+-----------+------------------------------------+-------+------+------+----------------------------+-------
#   |@RID |players|status|player_turn|id                                  
|_links |_audit|_allow|_creation_date              |_author
----+-----+-------+------+-----------+------------------------------------+-------+------+------+----------------------------+-------
0   |#24:0|[3]    |open  |0          
|ff342a9b-79cd-4494-983e-6ec4a1a47c8a|#11:383|#3:370|[1]   
|2014-02-15T13:49:51.051+0100|admin
----+-----+-------+------+-----------+------------------------------------+-------+------+------+----------------------------+-------

or:
orientdb> select @this.toJson() from games
----+-----+-----------------------------------------------------------------------------------------------------------------
#   |@RID |this
----+-----+-----------------------------------------------------------------------------------------------------------------
0   
|#-2:1|{"@type":"d","@rid":"#24:0","@version":2,"@class":"games","players":[{"username":"[email protected]","name":"john
 
...
----+-----+-----------------------------------------------------------------------------------------------------------------
1 item(s) found. Query executed in 0.041 sec(s).

Everything seems to be fine.
However when I try to expand the players field I have this error:

orientdb> select expand(players) from games
Error: 
com.orientechnologies.orient.core.exception.OCommandExecutionException: 
Error on execution of command: sql.select expand(players) from games
Error: java.lang.ClassCastException: 
com.orientechnologies.orient.core.db.record.OTrackedMap cannot be cast to 
com.orientechnologies.orient.core.db.re
cord.OIdentifiable

Furthermore I cannot execute any selection criteria against the players 
field:
orientdb> select from games where players contains (username = 
"[email protected]")
0 item(s) found. Query executed in 0.0020 sec(s).

orientdb> select from games where players[username] = "[email protected]"
0 item(s) found. Query executed in 0.0040 sec(s).

orientdb> select from games where players[username = "[email protected]"]
Error: 
com.orientechnologies.orient.core.exception.OCommandExecutionException: 
Error on execution of command: sql.select from games where players[user
name = "[email protected]"]
Error: java.lang.ClassCastException: 
com.orientechnologies.orient.core.db.record.OTrackedMap cannot be cast to 
java.lang.Boolean

Any suggestion?

Thanks!

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to