Hello.

if  I use Attributes Based Configuration I can put enitity into the cache
via key value api and than read rhis entity through the dbeaver(select *
from testentity)

*Code:*

namespace Example

{

    public class TestEntity

    {

        [QuerySqlField]

        public string ValueString { get; set; }



        [QuerySqlField]

        public DateTime ValueDateTime { get; set; }

    }



    class Program

    {

        static void Main(string[] args)

        {

            var ignite = Ignition.StartClient(newIgniteClientConfiguration {
Host = "127.0.0.1" });



            var cache = ignite.GetOrCreateCache<int,TestEntity>(

                                   new CacheClientConfiguration("TestEntity"
, new QueryEntity[] { newQueryEntity(typeof(TestEntity)) }) { SqlSchema =
"PUBLIC" });



            cache.Put(1, new TestEntity { ValueString ="test",
ValueDateTime = DateTime.UtcNow });





            ignite.Dispose();

        }

    }
}



But when I use QueryEntity Based Configuration (that is what I actually
need) a have an error running the same query in dbeaver

*Code:*

namespace Example

{

    public class TestEntity

    {

        //[QuerySqlField]

        public string ValueString { get; set; }



        //[QuerySqlField]

        public DateTime ValueDateTime { get; set; }

    }



    class Program

    {

        static void Main(string[] args)

        {

            var ignite = Ignition.StartClient(newIgniteClientConfiguration {
Host = "127.0.0.1" });



            var queryEntity = new QueryEntity();

            queryEntity.KeyTypeName =typeof(int).FullName;

            queryEntity.KeyType = typeof(int);



            queryEntity.ValueTypeName =typeof(TestEntity).FullName;

            queryEntity.ValueType = typeof(TestEntity);



            queryEntity.Fields = new QueryField[]

            { new QueryField("ValueString", typeof(string))

            , new QueryField("ValueDateTime",typeof(DateTime))

            };



            var cache = ignite.GetOrCreateCache<int,TestEntity>(

                                           newCacheClientConfiguration(
"TestEntity", queryEntity) { SqlSchema = "PUBLIC" });





            cache.Put(1, new TestEntity { ValueString ="test",
ValueDateTime = DateTime.UtcNow });





            ignite.Dispose();

        }

    }
}

*Result in dbeaver (select * from testentity):*

SQL Error [50000]: javax.cache.CacheException: Failed to run map query
remotely.Failed to execute map query on the node:
71b3514c-8d19-448d-9ae0-295fca1f4cbc, class
org.apache.ignite.IgniteCheckedException:Failed to execute SQL query.
General error: "class org.apache.ignite.binary.BinaryInvalidTypeException:
Unknown pair [platformId=0, typeId=-1854586790]"; SQL statement:

SELECT

__Z0.VALUESTRING __C0_0,

__Z0.VALUEDATETIME __C0_1

FROM PUBLIC.TESTENTITY __Z0 [50000-195]


How to use entity-based configuration correctly to get the correct result
via odbc with DateTime fields?

Reply via email to