You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by jerpic <je...@misterfly.com> on 2017/11/15 13:03:51 UTC

Deserializing to an object from a request based on SqlQueryField.

Hi All,

I’m facing a problem to get the object from a query based on SqlQueryField.
Let me give you an example.


The type of the field A is : string
The type of the field B is : CustomizedObject with its own structure.

In the table STRUCTURE we can see that B has been correctly serialized. The
problem is when I try with the followed request to retrieve B I don’t obtain
the deserialized value of my object, I got a new structure composed with 2
fields (an array (with the pseudo object) and a raw field).

So my question is how can I deserialzed the value of the field in order to
get the real original object?

Any help would be very much appreciated.

Regards,

Here is the request :

string select = "SELECT A, B  " +
	 "FROM \"" + CACHE + "\".STRUCTURE ";

var fieldsQuery = new SqlFieldsQuery(select);
fieldsQuery.EnableDistributedJoins = true;

var res = cacheOneWayProposals.QueryFields(fieldsQuery).GetAll();

foreach(var row in res)
{
                
string A = row[0].ToString();
var B = row[1];

…………
		
}








--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Deserializing to an object from a request based on SqlQueryField.

Posted by jerpic <je...@misterfly.com>.
Hi again Mike,

I'm confuse, in fact I did a basic mistake with the cast of the object.....
So, there is no problem ;-)

Thanks for your help.

Regards,
Jérôme.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Deserializing to an object from a request based on SqlQueryField.

Posted by jerpic <je...@misterfly.com>.
Hi Mike,

Thanks for you answer. 

Yes, I marked the B field with [QuerySqlField], and you are right I use C#.

I did a mistake in the presentation of my problel, in fact the B field is an
ArrayList of the CustomizedObject, maybe it can help...

Regards,
Jerome.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Deserializing to an object from a request based on SqlQueryField.

Posted by Mikhail <mi...@gmail.com>.
Hi,

did you mark B field with @QuerySqlField?
I'm just checked you case and it works fine for me, but I used java while
you I guess you c#, don't you?

Thanks,
Mike.




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/