ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pavel Tupitsyn <ptupit...@gridgain.com>
Subject Re: .NET SQLQuery Error
Date Mon, 11 Apr 2016 11:27:30 GMT
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 <ksatya@gmail.com>
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 <ptupitsyn@gridgain.com>
> 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 <ksatya@gmail.com>
>> 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.
>>>
>>> [image: 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 <ptupitsyn@gridgain.com>
>>> 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 <ksatya@gmail.com>
>>>> 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.
>>>>>
>>>>> https://drive.google.com/open?id=0B8lM91-_3MwRYUxqX2ZHU0thRmc
>>>>>
>>>>> Thanks again for your help,
>>>>> Satya.
>>>>>
>>>>> On Sun, Apr 10, 2016 at 2:33 AM, Pavel Tupitsyn <
>>>>> ptupitsyn@gridgain.com> 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 <ksatya@gmail.com>
>>>>>> 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 <
>>>>>>> ptupitsyn@gridgain.com> 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 <
>>>>>>>> ksatya@gmail.com> 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.
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Mime
View raw message