[ 
https://issues.apache.org/jira/browse/IGNITE-15785?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrey Mashenkov updated IGNITE-15785:
--------------------------------------
    Description: 
Let's verify POJO class is compatible with the current schema.
* Mapper must bind all the key columns with the object fields, because missed 
key-column may lead to error/data loss.
* Key and value columns must have different names, because otherwise these 
columns can't be mapped to a Record class.

NB: Mapper result may not match the full schema for truncated objects.
{code:java}
class BillingDetails {
    String owner;
}

class CreditCard extends BillingDetails {
       long cardNumber;
       int expYear;
       int expMonth;
}

KeyValueView<Long, CreditCard> credCardKvView = table.keyValueView(Long.class, 
CreditCard.class);
   
// Truncated view.
KeyValueView<Long, BillingDetails> billingDetailsKVView = 
table.keyValueView(Long.class, BillingDetails.class);
{code}





  was:
Let's verify POJO class is compatible with the current schema.

NB: Mapper result may not match the full schema for truncated objects.
{code:java}
class BillingDetails {
    String owner;
}

class CreditCard extends BillingDetails {
       long cardNumber;
       int expYear;
       int expMonth;
}

KeyValueView<Long, CreditCard> credCardKvView = table.keyValueView(Long.class, 
CreditCard.class);
   
// Truncated view.
KeyValueView<Long, BillingDetails> billingDetailsKVView = 
table.keyValueView(Long.class, BillingDetails.class);
{code}






> POJO validation against the schema.
> -----------------------------------
>
>                 Key: IGNITE-15785
>                 URL: https://issues.apache.org/jira/browse/IGNITE-15785
>             Project: Ignite
>          Issue Type: Improvement
>          Components: sql
>            Reporter: Andrey Mashenkov
>            Assignee: Alexander Belyak
>            Priority: Major
>              Labels: ignite-3
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> Let's verify POJO class is compatible with the current schema.
> * Mapper must bind all the key columns with the object fields, because missed 
> key-column may lead to error/data loss.
> * Key and value columns must have different names, because otherwise these 
> columns can't be mapped to a Record class.
> NB: Mapper result may not match the full schema for truncated objects.
> {code:java}
> class BillingDetails {
>     String owner;
> }
> class CreditCard extends BillingDetails {
>        long cardNumber;
>        int expYear;
>        int expMonth;
> }
> KeyValueView<Long, CreditCard> credCardKvView = 
> table.keyValueView(Long.class, CreditCard.class);
>    
> // Truncated view.
> KeyValueView<Long, BillingDetails> billingDetailsKVView = 
> table.keyValueView(Long.class, BillingDetails.class);
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to