For anyone else who stumbles upon this, they way I was ultimately able to 
get @fieldTypes to work (in 2.0.12) was to include the metadata "@type":"d" 
in each nested embedded dictionary.
I found the clue here: 
https://groups.google.com/forum/#!msg/orient-database/P3LqMHW7hdY/LIreE1UxddQJ
So in this case, the following would work:
insert into myClass (name,meta) values ("claudio",{"country":"italy", 
"date":"2013-01-01","@fieldTypes":"date=d", "@type":"d"})



On Sunday, February 3, 2013 at 6:49:42 AM UTC-8, Claudio wrote:
>
> Hi,
> is it possible to specify the type of a field in an embedded document 
> using the @fieldTypes field?
> I tried this:
>
> insert into myClass (myDate) values 
> ({"date":"2013-01-01","@fieldTypes":"date=d"})
>
> Now to check that internally the date field was a Date, I tried the 
> following update:
> update myClass  increment myDate.date = 1
>
> I was expecting a java.util.Date CastException, but I had:
> Error: 
> com.orientechnologies.orient.core.exception.OCommandExecutionException: 
> Error on execution of command: OSQLQuery [text=select from MYCLASS]
> Error: java.lang.ClassCastException: java.lang.String cannot be cast to 
> java.lang.Number
>
> It seems that internally the date field is a String not a Date.
>
> 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/d/optout.

Reply via email to