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.kuliche...@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 <irud...@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.kuliche...@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
>>>
>>
>>
>

Reply via email to