zaid,
In this case "id" column will be created. If you query this attribute,
PersonPK will be returned.

Sergi,
This is in fact widely-used pattern which I saw many times in production
systems. It allows user to have self-contained object. Otherwise one will
have to introduce third value object which will hold both key and val parts.

On Thu, Feb 16, 2017 at 2:15 PM, Sergi Vladykin <[email protected]>
wrote:

> If you are going to store this stuff in cache like
>
> cache.put(myPersonPK, myPerson)
>
> then storing PersonPK inside of Person is bad idea, because PK will be
> stored twice in cache.
>
> I'm not sure I understand your question, but it seems to me that you don't
> need to do anything here because cache key is always accessible from SQL as
> _KEY field.
>
> Sergi
>
> 2017-02-16 13:48 GMT+03:00 zaid <[email protected]>:
>
>> Hi,
>>
>> My POJO has composite primary key.
>>
>> e.g.
>>
>> public class Person {
>>
>> PersonPK id;
>>
>> String name;
>>
>> }
>>
>> public class PersonPK {
>> Long id1;
>> String personType;
>> }
>>
>> These classes are just for example purpose. My question is - can I apply
>> @SqlQueryField directly on id field in Person class which is of type
>> PersonPK. How this will be used while creating table in H2?
>>
>>
>>
>>
>>
>> --
>> View this message in context: http://apache-ignite-users.705
>> 18.x6.nabble.com/SqlQueryField-on-composite-primary-key-tp10666.html
>> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>>
>
>

Reply via email to