ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Igor Rudyak <irud...@gmail.com>
Subject Re: Cassandra issue
Date Tue, 30 Aug 2016 03:51:00 GMT
Valentin,

You right, it's rather easy to handle such kind of exception and re-throw
more descriptive one. Here is a new ticket for this:
https://issues.apache.org/jira/browse/IGNITE-3799

Igor

On Mon, Aug 29, 2016 at 8:29 PM, Valentin Kulichenko <
valentin.kulichenko@gmail.com> wrote:

> Igor,
>
> Thanks! How do you think, is there a way to validate this on the earlier
> stages and throw more descriptive exception? Currently this looks like a
> usability issue.
>
> -Val
>
> On Mon, Aug 29, 2016 at 8:05 PM, Igor Rudyak <irudyak@gmail.com> wrote:
>
>> Hi Valentin,
>>
>> You are right - the reason is in "id" field. According to the persistence
>> descriptor, cache key will be stored in "id" field, but at the same time
>> User POJO class also has such field. There are several options to fix this:
>>
>> 1) Specify another column mapping for Ignite cache key. For example:
>>
>> <keyPersistence class="java.util.UUID" strategy="PRIMITIVE" column="userId" />
>>
>>
>> 2) Specify non default column mapping for "id" field in User class. Here
>> are the options to do this:
>>
>>    a) Mark "id" field by *@QuerySqlField* annotation and specify name
>> which is differ than "id". For example:
>>
>> *       @QuerySqlField(name="userId")*
>>
>>    b) Manually specify columns mapping for User class in xml persistence
>> descriptor and make sure that "id" field is mapped to something differ that
>> "id". For example:
>>
>> <valuePersistence class="*****.User" strategy="POJO">
>>     <field name="id" column="userId"/>
>>     <field name="name" />
>> </valuePersistence>
>>
>>
>> 3) Manually specify columns mapping for User class in xml persistence
>> descriptor and omit "id" field - such a way "id" field from User class
>> simply will not be persisted into Cassandra table. Which makes sense if you
>> already have absolutely the same value for Ignite cache key - you don't
>> need to save the same value twice into two different columns. Example:
>>
>> <valuePersistence class="*****.User" strategy="POJO">
>>     <field name="name" />
>> </valuePersistence>
>>
>>
>>
>> Regards,
>> Igor Rudyak
>>
>>
>>
>> On Mon, Aug 29, 2016 at 7:15 PM, Valentin Kulichenko <
>> valentin.kulichenko@gmail.com> wrote:
>>
>>> Hi Igor,
>>>
>>> Will you have a chance to take another look at user's issue [1]? As far
>>> as I understand, this happens because the key column name is "id" and there
>>> is "id" field in the value class. Is this a valid configuration?
>>>
>>> [1] http://apache-ignite-users.70518.x6.nabble.com/Ignite-wi
>>> th-Cassandra-td7242.html
>>>
>>> -Val
>>>
>>
>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message