.NET SQLQuery Error

classic Classic list List threaded Threaded
13 messages Options
ksatya ksatya
Reply | Threaded
Open this post in threaded view
|

.NET SQLQuery Error

Hi All,
    I am running into below error trying to run SqlQuery in .NET. 

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-2146233088
  Message=Indexing is disabled for cache: BU. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
  Source=Apache.Ignite.Core

I am storing the entity created by Entity Framework in cache and trying to query that POCO. Below are my Ignite config xml and the query I am using.

<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="TestIgniteDAL.BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

   using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, BusinessUnit>("BU");
                var qry = cache.Query(new SqlQuery(typeof(BusinessUnit),"BUID=?",5));
                foreach(var bu in qry)
                {
                    Console.WriteLine(bu);
                }
            }

Also, do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world. Or can I use .NET equivalent classes from the POCO that was generated from Entity Framework?

Thanks,
Satya.
Pavel Tupitsyn Pavel Tupitsyn
Reply | Threaded
Open this post in threaded view
|

Re: .NET SQLQuery Error

Hi Satya,

Indexing is disabled for cache: BU.
In the XML configuration, please set cache name like this:

...
<bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
...


do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world
Yes, in 1.5, using Spring XML and Java types is the only way.
This is already fixed, and in upcoming Ignite 1.6 everything can be configured right from C#.

Thanks,
Pavel.

On Sat, Apr 9, 2016 at 5:10 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi All,
    I am running into below error trying to run SqlQuery in .NET. 

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-2146233088
  Message=Indexing is disabled for cache: BU. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
  Source=Apache.Ignite.Core

I am storing the entity created by Entity Framework in cache and trying to query that POCO. Below are my Ignite config xml and the query I am using.

<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="TestIgniteDAL.BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

   using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, BusinessUnit>("BU");
                var qry = cache.Query(new SqlQuery(typeof(BusinessUnit),"BUID=?",5));
                foreach(var bu in qry)
                {
                    Console.WriteLine(bu);
                }
            }

Also, do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world. Or can I use .NET equivalent classes from the POCO that was generated from Entity Framework?

Thanks,
Satya.

ksatya ksatya
Reply | Threaded
Open this post in threaded view
|

Re: .NET SQLQuery Error

Hi Pavel,
   Is that the only change needed? I added that property and I am still getting the same error.

<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="TestIgniteDAL.BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-2146233088
  Message=Indexing is disabled for cache: BU. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.CacheOutOpQueryCursor(Void* ctx, Void* obj, Int32 type, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.CacheOutOpQueryCursor(IUnmanagedTarget target, Int32 type, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Cache.CacheImpl`2.Query(QueryBase qry)
       at TestIgniteSQLClient.IgniteSQLClient.Main(String[] args) in C:\Data\Professional\dotnet\workspace\TestIgnite\TestIgniteSQLClient\IgniteSQLClient.cs:line 34
  InnerException: 


On Sat, Apr 9, 2016 at 11:32 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

Indexing is disabled for cache: BU.
In the XML configuration, please set cache name like this:

...
<bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
...


do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world
Yes, in 1.5, using Spring XML and Java types is the only way.
This is already fixed, and in upcoming Ignite 1.6 everything can be configured right from C#.

Thanks,
Pavel.

On Sat, Apr 9, 2016 at 5:10 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi All,
    I am running into below error trying to run SqlQuery in .NET. 

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Indexing is disabled for cache: BU. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
  Source=Apache.Ignite.Core

I am storing the entity created by Entity Framework in cache and trying to query that POCO. Below are my Ignite config xml and the query I am using.

<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="TestIgniteDAL.BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

   using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, BusinessUnit>("BU");
                var qry = cache.Query(new SqlQuery(typeof(BusinessUnit),"BUID=?",5));
                foreach(var bu in qry)
                {
                    Console.WriteLine(bu);
                }
            }

Also, do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world. Or can I use .NET equivalent classes from the POCO that was generated from Entity Framework?

Thanks,
Satya.


Pavel Tupitsyn Pavel Tupitsyn
Reply | Threaded
Open this post in threaded view
|

Re: .NET SQLQuery Error

Satya, there is some issue with configuration in your code. Looks like you use different XML than provided above. Make sure the path is correct.
Or, you can attach your entire solution, and I'll take a look.

Pavel.

On Sat, Apr 9, 2016 at 7:29 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Is that the only change needed? I added that property and I am still getting the same error.

<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="TestIgniteDAL.BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-2146233088
  Message=Indexing is disabled for cache: BU. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.CacheOutOpQueryCursor(Void* ctx, Void* obj, Int32 type, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.CacheOutOpQueryCursor(IUnmanagedTarget target, Int32 type, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Cache.CacheImpl`2.Query(QueryBase qry)
       at TestIgniteSQLClient.IgniteSQLClient.Main(String[] args) in C:\Data\Professional\dotnet\workspace\TestIgnite\TestIgniteSQLClient\IgniteSQLClient.cs:line 34
  InnerException: 


On Sat, Apr 9, 2016 at 11:32 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

Indexing is disabled for cache: BU.
In the XML configuration, please set cache name like this:

...
<bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
...


do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world
Yes, in 1.5, using Spring XML and Java types is the only way.
This is already fixed, and in upcoming Ignite 1.6 everything can be configured right from C#.

Thanks,
Pavel.

On Sat, Apr 9, 2016 at 5:10 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi All,
    I am running into below error trying to run SqlQuery in .NET. 

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Indexing is disabled for cache: BU. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
  Source=Apache.Ignite.Core

I am storing the entity created by Entity Framework in cache and trying to query that POCO. Below are my Ignite config xml and the query I am using.

<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="TestIgniteDAL.BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

   using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, BusinessUnit>("BU");
                var qry = cache.Query(new SqlQuery(typeof(BusinessUnit),"BUID=?",5));
                foreach(var bu in qry)
                {
                    Console.WriteLine(bu);
                }
            }

Also, do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world. Or can I use .NET equivalent classes from the POCO that was generated from Entity Framework?

Thanks,
Satya.



ksatya ksatya
Reply | Threaded
Open this post in threaded view
|

Re: .NET SQLQuery Error

Hi Pavel,
    Below is the link to download the solution. The attached solution has 4 projects. TestIgniteServer is used to start Ignite node in server mode. TestIgniteSQLClient is used to start Ignite in client mode and execute the sql query against the cache.


Thanks again for your help,
Satya.

On Sun, Apr 10, 2016 at 2:33 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya, there is some issue with configuration in your code. Looks like you use different XML than provided above. Make sure the path is correct.
Or, you can attach your entire solution, and I'll take a look.

Pavel.

On Sat, Apr 9, 2016 at 7:29 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Is that the only change needed? I added that property and I am still getting the same error.

<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="TestIgniteDAL.BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Indexing is disabled for cache: BU. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.CacheOutOpQueryCursor(Void* ctx, Void* obj, Int32 type, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.CacheOutOpQueryCursor(IUnmanagedTarget target, Int32 type, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Cache.CacheImpl`2.Query(QueryBase qry)
       at TestIgniteSQLClient.IgniteSQLClient.Main(String[] args) in C:\Data\Professional\dotnet\workspace\TestIgnite\TestIgniteSQLClient\IgniteSQLClient.cs:line 34
  InnerException: 


On Sat, Apr 9, 2016 at 11:32 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

Indexing is disabled for cache: BU.
In the XML configuration, please set cache name like this:

...
<bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
...


do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world
Yes, in 1.5, using Spring XML and Java types is the only way.
This is already fixed, and in upcoming Ignite 1.6 everything can be configured right from C#.

Thanks,
Pavel.

On Sat, Apr 9, 2016 at 5:10 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi All,
    I am running into below error trying to run SqlQuery in .NET. 

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Indexing is disabled for cache: BU. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
  Source=Apache.Ignite.Core

I am storing the entity created by Entity Framework in cache and trying to query that POCO. Below are my Ignite config xml and the query I am using.

<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="TestIgniteDAL.BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

   using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, BusinessUnit>("BU");
                var qry = cache.Query(new SqlQuery(typeof(BusinessUnit),"BUID=?",5));
                foreach(var bu in qry)
                {
                    Console.WriteLine(bu);
                }
            }

Also, do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world. Or can I use .NET equivalent classes from the POCO that was generated from Entity Framework?

Thanks,
Satya.




Pavel Tupitsyn Pavel Tupitsyn
Reply | Threaded
Open this post in threaded view
|

Re: .NET SQLQuery Error

Looks like the problem is here: 
<property name="valueType" value="TestIgniteDAL.BusinessUnit"/>

Ignite uses type name without namespace in queries and binary objects, so correct line would be 
<property name="valueType" value="BusinessUnit"/>
Let me know if this helps.
Pavel.

On Sun, Apr 10, 2016 at 1:16 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
    Below is the link to download the solution. The attached solution has 4 projects. TestIgniteServer is used to start Ignite node in server mode. TestIgniteSQLClient is used to start Ignite in client mode and execute the sql query against the cache.


Thanks again for your help,
Satya.

On Sun, Apr 10, 2016 at 2:33 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya, there is some issue with configuration in your code. Looks like you use different XML than provided above. Make sure the path is correct.
Or, you can attach your entire solution, and I'll take a look.

Pavel.

On Sat, Apr 9, 2016 at 7:29 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Is that the only change needed? I added that property and I am still getting the same error.

<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="TestIgniteDAL.BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Indexing is disabled for cache: BU. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.CacheOutOpQueryCursor(Void* ctx, Void* obj, Int32 type, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.CacheOutOpQueryCursor(IUnmanagedTarget target, Int32 type, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Cache.CacheImpl`2.Query(QueryBase qry)
       at TestIgniteSQLClient.IgniteSQLClient.Main(String[] args) in C:\Data\Professional\dotnet\workspace\TestIgnite\TestIgniteSQLClient\IgniteSQLClient.cs:line 34
  InnerException: 


On Sat, Apr 9, 2016 at 11:32 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

Indexing is disabled for cache: BU.
In the XML configuration, please set cache name like this:

...
<bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
...


do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world
Yes, in 1.5, using Spring XML and Java types is the only way.
This is already fixed, and in upcoming Ignite 1.6 everything can be configured right from C#.

Thanks,
Pavel.

On Sat, Apr 9, 2016 at 5:10 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi All,
    I am running into below error trying to run SqlQuery in .NET. 

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Indexing is disabled for cache: BU. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
  Source=Apache.Ignite.Core

I am storing the entity created by Entity Framework in cache and trying to query that POCO. Below are my Ignite config xml and the query I am using.

<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="TestIgniteDAL.BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

   using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, BusinessUnit>("BU");
                var qry = cache.Query(new SqlQuery(typeof(BusinessUnit),"BUID=?",5));
                foreach(var bu in qry)
                {
                    Console.WriteLine(bu);
                }
            }

Also, do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world. Or can I use .NET equivalent classes from the POCO that was generated from Entity Framework?

Thanks,
Satya.





ksatya ksatya
Reply | Threaded
Open this post in threaded view
|

Re: .NET SQLQuery Error

Hi Pavel...Thanks for the update. I seem to be doing something wrong. I am still getting the same error even after applying the update you suggested. Not sure if the way I specified the types for the columns in java matched against definitions in SQL Server. I am attaching below the column types from SQL Server.

Inline image 1

Below is the updated config xml
<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

Is there a different way to specify the indexed type? In java, I can specify at the CacheConfiguration object leve, but .NET API had no such method and spring config seems to be the only way unless I am missing anything.

Your help is much appreciated,
Satya.

On Sun, Apr 10, 2016 at 9:23 AM, Pavel Tupitsyn <[hidden email]> wrote:
Looks like the problem is here: 
<property name="valueType" value="TestIgniteDAL.BusinessUnit"/>

Ignite uses type name without namespace in queries and binary objects, so correct line would be 
<property name="valueType" value="BusinessUnit"/>
Let me know if this helps.
Pavel.

On Sun, Apr 10, 2016 at 1:16 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
    Below is the link to download the solution. The attached solution has 4 projects. TestIgniteServer is used to start Ignite node in server mode. TestIgniteSQLClient is used to start Ignite in client mode and execute the sql query against the cache.


Thanks again for your help,
Satya.

On Sun, Apr 10, 2016 at 2:33 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya, there is some issue with configuration in your code. Looks like you use different XML than provided above. Make sure the path is correct.
Or, you can attach your entire solution, and I'll take a look.

Pavel.

On Sat, Apr 9, 2016 at 7:29 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Is that the only change needed? I added that property and I am still getting the same error.

<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="TestIgniteDAL.BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Indexing is disabled for cache: BU. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.CacheOutOpQueryCursor(Void* ctx, Void* obj, Int32 type, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.CacheOutOpQueryCursor(IUnmanagedTarget target, Int32 type, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Cache.CacheImpl`2.Query(QueryBase qry)
       at TestIgniteSQLClient.IgniteSQLClient.Main(String[] args) in C:\Data\Professional\dotnet\workspace\TestIgnite\TestIgniteSQLClient\IgniteSQLClient.cs:line 34
  InnerException: 


On Sat, Apr 9, 2016 at 11:32 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

Indexing is disabled for cache: BU.
In the XML configuration, please set cache name like this:

...
<bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
...


do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world
Yes, in 1.5, using Spring XML and Java types is the only way.
This is already fixed, and in upcoming Ignite 1.6 everything can be configured right from C#.

Thanks,
Pavel.

On Sat, Apr 9, 2016 at 5:10 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi All,
    I am running into below error trying to run SqlQuery in .NET. 

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Indexing is disabled for cache: BU. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
  Source=Apache.Ignite.Core

I am storing the entity created by Entity Framework in cache and trying to query that POCO. Below are my Ignite config xml and the query I am using.

<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="TestIgniteDAL.BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

   using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, BusinessUnit>("BU");
                var qry = cache.Query(new SqlQuery(typeof(BusinessUnit),"BUID=?",5));
                foreach(var bu in qry)
                {
                    Console.WriteLine(bu);
                }
            }

Also, do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world. Or can I use .NET equivalent classes from the POCO that was generated from Entity Framework?

Thanks,
Satya.






Pavel Tupitsyn Pavel Tupitsyn
Reply | Threaded
Open this post in threaded view
|

Re: .NET SQLQuery Error

Satya, I can run your solution without errors with fixed config.
This means that you don't actually use the config above for your nodes. Something else gets loaded for some reason.

Please do the following:
* Make sure that SpringConfigUrl points to the updated file everywhere you use it.
* Replace GetOrCreateCache with GetCache. This will ensure that cache is retrieved from config, not started dynamically.

Pavel.


On Sun, Apr 10, 2016 at 4:48 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel...Thanks for the update. I seem to be doing something wrong. I am still getting the same error even after applying the update you suggested. Not sure if the way I specified the types for the columns in java matched against definitions in SQL Server. I am attaching below the column types from SQL Server.

Inline image 1

Below is the updated config xml
<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

Is there a different way to specify the indexed type? In java, I can specify at the CacheConfiguration object leve, but .NET API had no such method and spring config seems to be the only way unless I am missing anything.

Your help is much appreciated,
Satya.

On Sun, Apr 10, 2016 at 9:23 AM, Pavel Tupitsyn <[hidden email]> wrote:
Looks like the problem is here: 
<property name="valueType" value="TestIgniteDAL.BusinessUnit"/>

Ignite uses type name without namespace in queries and binary objects, so correct line would be 
<property name="valueType" value="BusinessUnit"/>
Let me know if this helps.
Pavel.

On Sun, Apr 10, 2016 at 1:16 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
    Below is the link to download the solution. The attached solution has 4 projects. TestIgniteServer is used to start Ignite node in server mode. TestIgniteSQLClient is used to start Ignite in client mode and execute the sql query against the cache.


Thanks again for your help,
Satya.

On Sun, Apr 10, 2016 at 2:33 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya, there is some issue with configuration in your code. Looks like you use different XML than provided above. Make sure the path is correct.
Or, you can attach your entire solution, and I'll take a look.

Pavel.

On Sat, Apr 9, 2016 at 7:29 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Is that the only change needed? I added that property and I am still getting the same error.

<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="TestIgniteDAL.BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Indexing is disabled for cache: BU. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.CacheOutOpQueryCursor(Void* ctx, Void* obj, Int32 type, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.CacheOutOpQueryCursor(IUnmanagedTarget target, Int32 type, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Cache.CacheImpl`2.Query(QueryBase qry)
       at TestIgniteSQLClient.IgniteSQLClient.Main(String[] args) in C:\Data\Professional\dotnet\workspace\TestIgnite\TestIgniteSQLClient\IgniteSQLClient.cs:line 34
  InnerException: 


On Sat, Apr 9, 2016 at 11:32 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

Indexing is disabled for cache: BU.
In the XML configuration, please set cache name like this:

...
<bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
...


do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world
Yes, in 1.5, using Spring XML and Java types is the only way.
This is already fixed, and in upcoming Ignite 1.6 everything can be configured right from C#.

Thanks,
Pavel.

On Sat, Apr 9, 2016 at 5:10 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi All,
    I am running into below error trying to run SqlQuery in .NET. 

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Indexing is disabled for cache: BU. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
  Source=Apache.Ignite.Core

I am storing the entity created by Entity Framework in cache and trying to query that POCO. Below are my Ignite config xml and the query I am using.

<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="TestIgniteDAL.BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

   using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, BusinessUnit>("BU");
                var qry = cache.Query(new SqlQuery(typeof(BusinessUnit),"BUID=?",5));
                foreach(var bu in qry)
                {
                    Console.WriteLine(bu);
                }
            }

Also, do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world. Or can I use .NET equivalent classes from the POCO that was generated from Entity Framework?

Thanks,
Satya.







ksatya ksatya
Reply | Threaded
Open this post in threaded view
|

Re: .NET SQLQuery Error

Hi Pavel,
    You are absolutely right. I had 2 config files and I indeed am referring to wrong version. I copied and pasted and VS and instead of creating a new file, it created a link. Thanks for helping me out.

Based on your suggestion that the valueType needs to be unqualified without the namespace, the documentation needs an update. I was basically following that as an example.  But without namespace qualification, doesn't that force an user to create unique classnames?
<bean class="org.apache.ignite.cache.CacheTypeMetadata">
        <!-- Type to query. -->
        <property name="valueType" value="org.apache.ignite.examples.datagrid.store.Person"/>
        <!-- Fields to be queried. -->

On Mon, Apr 11, 2016 at 4:36 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya, I can run your solution without errors with fixed config.
This means that you don't actually use the config above for your nodes. Something else gets loaded for some reason.

Please do the following:
* Make sure that SpringConfigUrl points to the updated file everywhere you use it.
* Replace GetOrCreateCache with GetCache. This will ensure that cache is retrieved from config, not started dynamically.

Pavel.


On Sun, Apr 10, 2016 at 4:48 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel...Thanks for the update. I seem to be doing something wrong. I am still getting the same error even after applying the update you suggested. Not sure if the way I specified the types for the columns in java matched against definitions in SQL Server. I am attaching below the column types from SQL Server.

Inline image 1

Below is the updated config xml
<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

Is there a different way to specify the indexed type? In java, I can specify at the CacheConfiguration object leve, but .NET API had no such method and spring config seems to be the only way unless I am missing anything.

Your help is much appreciated,
Satya.

On Sun, Apr 10, 2016 at 9:23 AM, Pavel Tupitsyn <[hidden email]> wrote:
Looks like the problem is here: 
<property name="valueType" value="TestIgniteDAL.BusinessUnit"/>

Ignite uses type name without namespace in queries and binary objects, so correct line would be 
<property name="valueType" value="BusinessUnit"/>
Let me know if this helps.
Pavel.

On Sun, Apr 10, 2016 at 1:16 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
    Below is the link to download the solution. The attached solution has 4 projects. TestIgniteServer is used to start Ignite node in server mode. TestIgniteSQLClient is used to start Ignite in client mode and execute the sql query against the cache.


Thanks again for your help,
Satya.

On Sun, Apr 10, 2016 at 2:33 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya, there is some issue with configuration in your code. Looks like you use different XML than provided above. Make sure the path is correct.
Or, you can attach your entire solution, and I'll take a look.

Pavel.

On Sat, Apr 9, 2016 at 7:29 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Is that the only change needed? I added that property and I am still getting the same error.

<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="TestIgniteDAL.BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Indexing is disabled for cache: BU. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.CacheOutOpQueryCursor(Void* ctx, Void* obj, Int32 type, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.CacheOutOpQueryCursor(IUnmanagedTarget target, Int32 type, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Cache.CacheImpl`2.Query(QueryBase qry)
       at TestIgniteSQLClient.IgniteSQLClient.Main(String[] args) in C:\Data\Professional\dotnet\workspace\TestIgnite\TestIgniteSQLClient\IgniteSQLClient.cs:line 34
  InnerException: 


On Sat, Apr 9, 2016 at 11:32 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

Indexing is disabled for cache: BU.
In the XML configuration, please set cache name like this:

...
<bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
...


do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world
Yes, in 1.5, using Spring XML and Java types is the only way.
This is already fixed, and in upcoming Ignite 1.6 everything can be configured right from C#.

Thanks,
Pavel.

On Sat, Apr 9, 2016 at 5:10 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi All,
    I am running into below error trying to run SqlQuery in .NET. 

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Indexing is disabled for cache: BU. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
  Source=Apache.Ignite.Core

I am storing the entity created by Entity Framework in cache and trying to query that POCO. Below are my Ignite config xml and the query I am using.

<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="TestIgniteDAL.BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

   using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, BusinessUnit>("BU");
                var qry = cache.Query(new SqlQuery(typeof(BusinessUnit),"BUID=?",5));
                foreach(var bu in qry)
                {
                    Console.WriteLine(bu);
                }
            }

Also, do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world. Or can I use .NET equivalent classes from the POCO that was generated from Entity Framework?

Thanks,
Satya.








Pavel Tupitsyn Pavel Tupitsyn
Reply | Threaded
Open this post in threaded view
|

Re: .NET SQLQuery Error

In fact, keyType and valType can be arbitrary strings.
They are used to create SQL tables internally.
Look at SqlQuery constructors: some of them accept "string queryType". This string must be equal to valType string in configuration.

Using type name without namespace is just a convention. SqlQuery constructor with "Type queryType" argument just passes along type name string.

This does not force the user to create unique classnames, because there is a separate SQL schema for each cache in Ignite.
Only if you use multiple entry types in a single cache (which is not recommended by itself), and these types have the same name, there will be a collision.

Sounds complicated, I know. Can't wait for 1.6 release where all of this is hidden from the user :)

Let me know if you need more details.

Pavel.

On Mon, Apr 11, 2016 at 1:32 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
    You are absolutely right. I had 2 config files and I indeed am referring to wrong version. I copied and pasted and VS and instead of creating a new file, it created a link. Thanks for helping me out.

Based on your suggestion that the valueType needs to be unqualified without the namespace, the documentation needs an update. I was basically following that as an example.  But without namespace qualification, doesn't that force an user to create unique classnames?
<bean class="org.apache.ignite.cache.CacheTypeMetadata">
        <!-- Type to query. -->
        <property name="valueType" value="org.apache.ignite.examples.datagrid.store.Person"/>
        <!-- Fields to be queried. -->

On Mon, Apr 11, 2016 at 4:36 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya, I can run your solution without errors with fixed config.
This means that you don't actually use the config above for your nodes. Something else gets loaded for some reason.

Please do the following:
* Make sure that SpringConfigUrl points to the updated file everywhere you use it.
* Replace GetOrCreateCache with GetCache. This will ensure that cache is retrieved from config, not started dynamically.

Pavel.


On Sun, Apr 10, 2016 at 4:48 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel...Thanks for the update. I seem to be doing something wrong. I am still getting the same error even after applying the update you suggested. Not sure if the way I specified the types for the columns in java matched against definitions in SQL Server. I am attaching below the column types from SQL Server.

Inline image 1

Below is the updated config xml
<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

Is there a different way to specify the indexed type? In java, I can specify at the CacheConfiguration object leve, but .NET API had no such method and spring config seems to be the only way unless I am missing anything.

Your help is much appreciated,
Satya.

On Sun, Apr 10, 2016 at 9:23 AM, Pavel Tupitsyn <[hidden email]> wrote:
Looks like the problem is here: 
<property name="valueType" value="TestIgniteDAL.BusinessUnit"/>

Ignite uses type name without namespace in queries and binary objects, so correct line would be 
<property name="valueType" value="BusinessUnit"/>
Let me know if this helps.
Pavel.

On Sun, Apr 10, 2016 at 1:16 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
    Below is the link to download the solution. The attached solution has 4 projects. TestIgniteServer is used to start Ignite node in server mode. TestIgniteSQLClient is used to start Ignite in client mode and execute the sql query against the cache.


Thanks again for your help,
Satya.

On Sun, Apr 10, 2016 at 2:33 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya, there is some issue with configuration in your code. Looks like you use different XML than provided above. Make sure the path is correct.
Or, you can attach your entire solution, and I'll take a look.

Pavel.

On Sat, Apr 9, 2016 at 7:29 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Is that the only change needed? I added that property and I am still getting the same error.

<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="TestIgniteDAL.BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Indexing is disabled for cache: BU. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.CacheOutOpQueryCursor(Void* ctx, Void* obj, Int32 type, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.CacheOutOpQueryCursor(IUnmanagedTarget target, Int32 type, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Cache.CacheImpl`2.Query(QueryBase qry)
       at TestIgniteSQLClient.IgniteSQLClient.Main(String[] args) in C:\Data\Professional\dotnet\workspace\TestIgnite\TestIgniteSQLClient\IgniteSQLClient.cs:line 34
  InnerException: 


On Sat, Apr 9, 2016 at 11:32 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

Indexing is disabled for cache: BU.
In the XML configuration, please set cache name like this:

...
<bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
...


do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world
Yes, in 1.5, using Spring XML and Java types is the only way.
This is already fixed, and in upcoming Ignite 1.6 everything can be configured right from C#.

Thanks,
Pavel.

On Sat, Apr 9, 2016 at 5:10 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi All,
    I am running into below error trying to run SqlQuery in .NET. 

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Indexing is disabled for cache: BU. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
  Source=Apache.Ignite.Core

I am storing the entity created by Entity Framework in cache and trying to query that POCO. Below are my Ignite config xml and the query I am using.

<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="TestIgniteDAL.BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

   using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, BusinessUnit>("BU");
                var qry = cache.Query(new SqlQuery(typeof(BusinessUnit),"BUID=?",5));
                foreach(var bu in qry)
                {
                    Console.WriteLine(bu);
                }
            }

Also, do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world. Or can I use .NET equivalent classes from the POCO that was generated from Entity Framework?

Thanks,
Satya.









ksatya ksatya
Reply | Threaded
Open this post in threaded view
|

Re: .NET SQLQuery Error

That makes sense. Thanks for the explanation. Any idea what is the wait time for 1.6? Do you recommend building from source for 1.6 and use that till 1.6 is GA?

On Apr 11, 2016 7:28 AM, "Pavel Tupitsyn" <[hidden email]> wrote:
In fact, keyType and valType can be arbitrary strings.
They are used to create SQL tables internally.
Look at SqlQuery constructors: some of them accept "string queryType". This string must be equal to valType string in configuration.

Using type name without namespace is just a convention. SqlQuery constructor with "Type queryType" argument just passes along type name string.

This does not force the user to create unique classnames, because there is a separate SQL schema for each cache in Ignite.
Only if you use multiple entry types in a single cache (which is not recommended by itself), and these types have the same name, there will be a collision.

Sounds complicated, I know. Can't wait for 1.6 release where all of this is hidden from the user :)

Let me know if you need more details.

Pavel.

On Mon, Apr 11, 2016 at 1:32 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
    You are absolutely right. I had 2 config files and I indeed am referring to wrong version. I copied and pasted and VS and instead of creating a new file, it created a link. Thanks for helping me out.

Based on your suggestion that the valueType needs to be unqualified without the namespace, the documentation needs an update. I was basically following that as an example.  But without namespace qualification, doesn't that force an user to create unique classnames?
<bean class="org.apache.ignite.cache.CacheTypeMetadata">
        <!-- Type to query. -->
        <property name="valueType" value="org.apache.ignite.examples.datagrid.store.Person"/>
        <!-- Fields to be queried. -->

On Mon, Apr 11, 2016 at 4:36 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya, I can run your solution without errors with fixed config.
This means that you don't actually use the config above for your nodes. Something else gets loaded for some reason.

Please do the following:
* Make sure that SpringConfigUrl points to the updated file everywhere you use it.
* Replace GetOrCreateCache with GetCache. This will ensure that cache is retrieved from config, not started dynamically.

Pavel.


On Sun, Apr 10, 2016 at 4:48 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel...Thanks for the update. I seem to be doing something wrong. I am still getting the same error even after applying the update you suggested. Not sure if the way I specified the types for the columns in java matched against definitions in SQL Server. I am attaching below the column types from SQL Server.

Inline image 1

Below is the updated config xml
<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

Is there a different way to specify the indexed type? In java, I can specify at the CacheConfiguration object leve, but .NET API had no such method and spring config seems to be the only way unless I am missing anything.

Your help is much appreciated,
Satya.

On Sun, Apr 10, 2016 at 9:23 AM, Pavel Tupitsyn <[hidden email]> wrote:
Looks like the problem is here: 
<property name="valueType" value="TestIgniteDAL.BusinessUnit"/>

Ignite uses type name without namespace in queries and binary objects, so correct line would be 
<property name="valueType" value="BusinessUnit"/>
Let me know if this helps.
Pavel.

On Sun, Apr 10, 2016 at 1:16 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
    Below is the link to download the solution. The attached solution has 4 projects. TestIgniteServer is used to start Ignite node in server mode. TestIgniteSQLClient is used to start Ignite in client mode and execute the sql query against the cache.


Thanks again for your help,
Satya.

On Sun, Apr 10, 2016 at 2:33 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya, there is some issue with configuration in your code. Looks like you use different XML than provided above. Make sure the path is correct.
Or, you can attach your entire solution, and I'll take a look.

Pavel.

On Sat, Apr 9, 2016 at 7:29 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Is that the only change needed? I added that property and I am still getting the same error.

<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="TestIgniteDAL.BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Indexing is disabled for cache: BU. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.CacheOutOpQueryCursor(Void* ctx, Void* obj, Int32 type, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.CacheOutOpQueryCursor(IUnmanagedTarget target, Int32 type, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Cache.CacheImpl`2.Query(QueryBase qry)
       at TestIgniteSQLClient.IgniteSQLClient.Main(String[] args) in C:\Data\Professional\dotnet\workspace\TestIgnite\TestIgniteSQLClient\IgniteSQLClient.cs:line 34
  InnerException: 


On Sat, Apr 9, 2016 at 11:32 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

Indexing is disabled for cache: BU.
In the XML configuration, please set cache name like this:

...
<bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
...


do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world
Yes, in 1.5, using Spring XML and Java types is the only way.
This is already fixed, and in upcoming Ignite 1.6 everything can be configured right from C#.

Thanks,
Pavel.

On Sat, Apr 9, 2016 at 5:10 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi All,
    I am running into below error trying to run SqlQuery in .NET. 

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Indexing is disabled for cache: BU. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
  Source=Apache.Ignite.Core

I am storing the entity created by Entity Framework in cache and trying to query that POCO. Below are my Ignite config xml and the query I am using.

<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="TestIgniteDAL.BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

   using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, BusinessUnit>("BU");
                var qry = cache.Query(new SqlQuery(typeof(BusinessUnit),"BUID=?",5));
                foreach(var bu in qry)
                {
                    Console.WriteLine(bu);
                }
            }

Also, do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world. Or can I use .NET equivalent classes from the POCO that was generated from Entity Framework?

Thanks,
Satya.









Pavel Tupitsyn Pavel Tupitsyn
Reply | Threaded
Open this post in threaded view
|

Re: .NET SQLQuery Error

Some say that 1.6 is expected by the end of the month, can't say for sure.

Obviously, I can't recommend to use unreleased code in production, but other than that, our master branch is usually stable, so you are welcome to try out latest features!
If you decide to do so, have a look at updated QueryExample and new LinqExample.
It is also possible to configure everything in .NET, without Spring XML.

By the way, to avoid building from sources manually, you can use NuGet package built from latest master on our CI server (use guest login):

Pavel.


On Mon, Apr 11, 2016 at 3:59 PM, Murthy Kakarlamudi <[hidden email]> wrote:

That makes sense. Thanks for the explanation. Any idea what is the wait time for 1.6? Do you recommend building from source for 1.6 and use that till 1.6 is GA?

On Apr 11, 2016 7:28 AM, "Pavel Tupitsyn" <[hidden email]> wrote:
In fact, keyType and valType can be arbitrary strings.
They are used to create SQL tables internally.
Look at SqlQuery constructors: some of them accept "string queryType". This string must be equal to valType string in configuration.

Using type name without namespace is just a convention. SqlQuery constructor with "Type queryType" argument just passes along type name string.

This does not force the user to create unique classnames, because there is a separate SQL schema for each cache in Ignite.
Only if you use multiple entry types in a single cache (which is not recommended by itself), and these types have the same name, there will be a collision.

Sounds complicated, I know. Can't wait for 1.6 release where all of this is hidden from the user :)

Let me know if you need more details.

Pavel.

On Mon, Apr 11, 2016 at 1:32 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
    You are absolutely right. I had 2 config files and I indeed am referring to wrong version. I copied and pasted and VS and instead of creating a new file, it created a link. Thanks for helping me out.

Based on your suggestion that the valueType needs to be unqualified without the namespace, the documentation needs an update. I was basically following that as an example.  But without namespace qualification, doesn't that force an user to create unique classnames?
<bean class="org.apache.ignite.cache.CacheTypeMetadata">
        <!-- Type to query. -->
        <property name="valueType" value="org.apache.ignite.examples.datagrid.store.Person"/>
        <!-- Fields to be queried. -->

On Mon, Apr 11, 2016 at 4:36 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya, I can run your solution without errors with fixed config.
This means that you don't actually use the config above for your nodes. Something else gets loaded for some reason.

Please do the following:
* Make sure that SpringConfigUrl points to the updated file everywhere you use it.
* Replace GetOrCreateCache with GetCache. This will ensure that cache is retrieved from config, not started dynamically.

Pavel.


On Sun, Apr 10, 2016 at 4:48 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel...Thanks for the update. I seem to be doing something wrong. I am still getting the same error even after applying the update you suggested. Not sure if the way I specified the types for the columns in java matched against definitions in SQL Server. I am attaching below the column types from SQL Server.

Inline image 1

Below is the updated config xml
<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

Is there a different way to specify the indexed type? In java, I can specify at the CacheConfiguration object leve, but .NET API had no such method and spring config seems to be the only way unless I am missing anything.

Your help is much appreciated,
Satya.

On Sun, Apr 10, 2016 at 9:23 AM, Pavel Tupitsyn <[hidden email]> wrote:
Looks like the problem is here: 
<property name="valueType" value="TestIgniteDAL.BusinessUnit"/>

Ignite uses type name without namespace in queries and binary objects, so correct line would be 
<property name="valueType" value="BusinessUnit"/>
Let me know if this helps.
Pavel.

On Sun, Apr 10, 2016 at 1:16 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
    Below is the link to download the solution. The attached solution has 4 projects. TestIgniteServer is used to start Ignite node in server mode. TestIgniteSQLClient is used to start Ignite in client mode and execute the sql query against the cache.


Thanks again for your help,
Satya.

On Sun, Apr 10, 2016 at 2:33 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya, there is some issue with configuration in your code. Looks like you use different XML than provided above. Make sure the path is correct.
Or, you can attach your entire solution, and I'll take a look.

Pavel.

On Sat, Apr 9, 2016 at 7:29 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Is that the only change needed? I added that property and I am still getting the same error.

<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="TestIgniteDAL.BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Indexing is disabled for cache: BU. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.CacheOutOpQueryCursor(Void* ctx, Void* obj, Int32 type, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.CacheOutOpQueryCursor(IUnmanagedTarget target, Int32 type, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Cache.CacheImpl`2.Query(QueryBase qry)
       at TestIgniteSQLClient.IgniteSQLClient.Main(String[] args) in C:\Data\Professional\dotnet\workspace\TestIgnite\TestIgniteSQLClient\IgniteSQLClient.cs:line 34
  InnerException: 


On Sat, Apr 9, 2016 at 11:32 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

Indexing is disabled for cache: BU.
In the XML configuration, please set cache name like this:

...
<bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
...


do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world
Yes, in 1.5, using Spring XML and Java types is the only way.
This is already fixed, and in upcoming Ignite 1.6 everything can be configured right from C#.

Thanks,
Pavel.

On Sat, Apr 9, 2016 at 5:10 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi All,
    I am running into below error trying to run SqlQuery in .NET. 

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Indexing is disabled for cache: BU. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
  Source=Apache.Ignite.Core

I am storing the entity created by Entity Framework in cache and trying to query that POCO. Below are my Ignite config xml and the query I am using.

<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="TestIgniteDAL.BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

   using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, BusinessUnit>("BU");
                var qry = cache.Query(new SqlQuery(typeof(BusinessUnit),"BUID=?",5));
                foreach(var bu in qry)
                {
                    Console.WriteLine(bu);
                }
            }

Also, do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world. Or can I use .NET equivalent classes from the POCO that was generated from Entity Framework?

Thanks,
Satya.










ksatya ksatya
Reply | Threaded
Open this post in threaded view
|

Re: .NET SQLQuery Error

Great..thanks for the info. We are not on production yet. We have a couple more months. Will try the approach you suggested.

Thanks.

On Apr 11, 2016 9:22 AM, "Pavel Tupitsyn" <[hidden email]> wrote:
Some say that 1.6 is expected by the end of the month, can't say for sure.

Obviously, I can't recommend to use unreleased code in production, but other than that, our master branch is usually stable, so you are welcome to try out latest features!
If you decide to do so, have a look at updated QueryExample and new LinqExample.
It is also possible to configure everything in .NET, without Spring XML.

By the way, to avoid building from sources manually, you can use NuGet package built from latest master on our CI server (use guest login):

Pavel.


On Mon, Apr 11, 2016 at 3:59 PM, Murthy Kakarlamudi <[hidden email]> wrote:

That makes sense. Thanks for the explanation. Any idea what is the wait time for 1.6? Do you recommend building from source for 1.6 and use that till 1.6 is GA?

On Apr 11, 2016 7:28 AM, "Pavel Tupitsyn" <[hidden email]> wrote:
In fact, keyType and valType can be arbitrary strings.
They are used to create SQL tables internally.
Look at SqlQuery constructors: some of them accept "string queryType". This string must be equal to valType string in configuration.

Using type name without namespace is just a convention. SqlQuery constructor with "Type queryType" argument just passes along type name string.

This does not force the user to create unique classnames, because there is a separate SQL schema for each cache in Ignite.
Only if you use multiple entry types in a single cache (which is not recommended by itself), and these types have the same name, there will be a collision.

Sounds complicated, I know. Can't wait for 1.6 release where all of this is hidden from the user :)

Let me know if you need more details.

Pavel.

On Mon, Apr 11, 2016 at 1:32 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
    You are absolutely right. I had 2 config files and I indeed am referring to wrong version. I copied and pasted and VS and instead of creating a new file, it created a link. Thanks for helping me out.

Based on your suggestion that the valueType needs to be unqualified without the namespace, the documentation needs an update. I was basically following that as an example.  But without namespace qualification, doesn't that force an user to create unique classnames?
<bean class="org.apache.ignite.cache.CacheTypeMetadata">
        <!-- Type to query. -->
        <property name="valueType" value="org.apache.ignite.examples.datagrid.store.Person"/>
        <!-- Fields to be queried. -->

On Mon, Apr 11, 2016 at 4:36 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya, I can run your solution without errors with fixed config.
This means that you don't actually use the config above for your nodes. Something else gets loaded for some reason.

Please do the following:
* Make sure that SpringConfigUrl points to the updated file everywhere you use it.
* Replace GetOrCreateCache with GetCache. This will ensure that cache is retrieved from config, not started dynamically.

Pavel.


On Sun, Apr 10, 2016 at 4:48 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel...Thanks for the update. I seem to be doing something wrong. I am still getting the same error even after applying the update you suggested. Not sure if the way I specified the types for the columns in java matched against definitions in SQL Server. I am attaching below the column types from SQL Server.

Inline image 1

Below is the updated config xml
<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

Is there a different way to specify the indexed type? In java, I can specify at the CacheConfiguration object leve, but .NET API had no such method and spring config seems to be the only way unless I am missing anything.

Your help is much appreciated,
Satya.

On Sun, Apr 10, 2016 at 9:23 AM, Pavel Tupitsyn <[hidden email]> wrote:
Looks like the problem is here: 
<property name="valueType" value="TestIgniteDAL.BusinessUnit"/>

Ignite uses type name without namespace in queries and binary objects, so correct line would be 
<property name="valueType" value="BusinessUnit"/>
Let me know if this helps.
Pavel.

On Sun, Apr 10, 2016 at 1:16 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
    Below is the link to download the solution. The attached solution has 4 projects. TestIgniteServer is used to start Ignite node in server mode. TestIgniteSQLClient is used to start Ignite in client mode and execute the sql query against the cache.


Thanks again for your help,
Satya.

On Sun, Apr 10, 2016 at 2:33 AM, Pavel Tupitsyn <[hidden email]> wrote:
Satya, there is some issue with configuration in your code. Looks like you use different XML than provided above. Make sure the path is correct.
Or, you can attach your entire solution, and I'll take a look.

Pavel.

On Sat, Apr 9, 2016 at 7:29 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi Pavel,
   Is that the only change needed? I added that property and I am still getting the same error.

<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="TestIgniteDAL.BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Indexing is disabled for cache: BU. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
  Source=Apache.Ignite.Core
  StackTrace:
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
       at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.CacheOutOpQueryCursor(Void* ctx, Void* obj, Int32 type, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.CacheOutOpQueryCursor(IUnmanagedTarget target, Int32 type, Int64 memPtr)
       at Apache.Ignite.Core.Impl.Cache.CacheImpl`2.Query(QueryBase qry)
       at TestIgniteSQLClient.IgniteSQLClient.Main(String[] args) in C:\Data\Professional\dotnet\workspace\TestIgnite\TestIgniteSQLClient\IgniteSQLClient.cs:line 34
  InnerException: 


On Sat, Apr 9, 2016 at 11:32 AM, Pavel Tupitsyn <[hidden email]> wrote:
Hi Satya,

Indexing is disabled for cache: BU.
In the XML configuration, please set cache name like this:

...
<bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="BU"/>
...


do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world
Yes, in 1.5, using Spring XML and Java types is the only way.
This is already fixed, and in upcoming Ignite 1.6 everything can be configured right from C#.

Thanks,
Pavel.

On Sat, Apr 9, 2016 at 5:10 PM, Murthy Kakarlamudi <[hidden email]> wrote:
Hi All,
    I am running into below error trying to run SqlQuery in .NET. 

Apache.Ignite.Core.Common.IgniteException was unhandled
  HResult=-<a href="tel:2146233088" value="+12146233088" target="_blank">2146233088
  Message=Indexing is disabled for cache: BU. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
  Source=Apache.Ignite.Core

I am storing the entity created by Entity Framework in cache and trying to query that POCO. Below are my Ignite config xml and the query I am using.

<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="writeThrough" value="true"/>
          <property name="readThrough" value="true"/>
          <property name="writeBehindEnabled" value="true"/>
          <property name="writeBehindFlushFrequency" value="120000"/>
          <property name="cacheStoreFactory">
            <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
              <property name="typeName" value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
            </bean>
          </property>
          <property name ="typeMetadata">
            <list>
              <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                <!-- Type to query. -->
                <property name="valueType" value="TestIgniteDAL.BusinessUnit"/>
                <!-- Fields to be queried. -->
                <property name="queryFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                    <entry key="BUName" value="java.lang.String"/>
                    <entry key="CreatedByID" value="java.lang.Long"/>
                    <entry key="CreatedDate" value="java.util.Date"/>
                    <entry key="ModifiedByID" value="java.lang.Long"/>
                    <entry key="ModifiedDate" value="java.util.Date"/>
                  </map>
                </property>
                <!-- Fields to index in ascending order. -->
                <property name="ascendingFields">
                  <map>
                    <entry key="BUID" value="java.lang.Long"/>
                  </map>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>

   using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Cache query example started");
                var cache = ignite.GetCache<int, BusinessUnit>("BU");
                var qry = cache.Query(new SqlQuery(typeof(BusinessUnit),"BUID=?",5));
                foreach(var bu in qry)
                {
                    Console.WriteLine(bu);
                }
            }

Also, do I have to specify the column type classes in java(ex java.lang.Long etc) in the config xml even if I am working in .NET world. Or can I use .NET equivalent classes from the POCO that was generated from Entity Framework?

Thanks,
Satya.