You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Bram Biesbrouck <br...@reinvention.be> on 2023/09/06 08:45:56 UTC

Question about JDBC polymorphism

Hi all,

I've been experimenting with Ignite over the past months and took an
unexpected (pleasant) deep dive.

Right now, I'm fiddling around with write-through and read-through, but I'm
stuck on one feature I'd really want to find a solution for database table
discriminator values and mapping them to a polymorph class hierarchy.

In a way, I'm looking for an Ignite alternative to JPA's
@DiscriminatorColumn
<https://docs.oracle.com/javaee%2F7%2Fapi%2F%2F/javax/persistence/DiscriminatorColumn.html>
annotation that creates different classes from records with different
column constants. Or just something similar. Documentation or examples of
support for polymorphism in general maybe?

I've started using low level configuration with JdbcType, QueryEntity and
complex keys, but I can't seem to find an acceptable solution to load
database records (from a single table) into different caches (or a single
cache with different binaries of distinct classes).

Any help or pointers in the right direction?
Do I need to write a custom Marchaller maybe?

b.
<http://www.reinvention.be> *Creative engineering & inventions*
Check our latest projects! <http://www.reinvention.be> *Bram Biesbrouck*
bram.biesbrouck@reinvention.be
+32 486 118280 <0032%20486%20118280>

Re: Question about JDBC polymorphism

Posted by Bram Biesbrouck <br...@reinvention.be>.
Hi Stephen,

Your answer totally makes sense, thank you.

greets,

b.
<http://www.reinvention.be> *Creative engineering & inventions*
Check our latest projects! <http://www.reinvention.be> *Bram Biesbrouck*
bram.biesbrouck@reinvention.be
+32 486 118280 <0032%20486%20118280>


On Wed, Sep 6, 2023 at 12:05 PM Stephen Darlington <sd...@apache.org>
wrote:

> The most straightforward answer might just be to create views in
> your source database. Out of the box, the cache store is really designed
> for a 1:1 mapping between table and cache. You *can* do more complex
> mappings, but it may require coding.
>
> On Wed, 6 Sept 2023 at 09:46, Bram Biesbrouck <
> bram.biesbrouck@reinvention.be> wrote:
>
>> Hi all,
>>
>> I've been experimenting with Ignite over the past months and took an
>> unexpected (pleasant) deep dive.
>>
>> Right now, I'm fiddling around with write-through and read-through, but
>> I'm stuck on one feature I'd really want to find a solution for database
>> table discriminator values and mapping them to a polymorph class hierarchy.
>>
>> In a way, I'm looking for an Ignite alternative to JPA's
>> @DiscriminatorColumn
>> <https://docs.oracle.com/javaee%2F7%2Fapi%2F%2F/javax/persistence/DiscriminatorColumn.html>
>> annotation that creates different classes from records with different
>> column constants. Or just something similar. Documentation or examples of
>> support for polymorphism in general maybe?
>>
>> I've started using low level configuration with JdbcType, QueryEntity and
>> complex keys, but I can't seem to find an acceptable solution to load
>> database records (from a single table) into different caches (or a single
>> cache with different binaries of distinct classes).
>>
>> Any help or pointers in the right direction?
>> Do I need to write a custom Marchaller maybe?
>>
>> b.
>> <http://www.reinvention.be> *Creative engineering & inventions*
>> Check our latest projects! <http://www.reinvention.be> *Bram Biesbrouck*
>> bram.biesbrouck@reinvention.be
>> +32 486 118280 <0032%20486%20118280>
>>
>

Re: Question about JDBC polymorphism

Posted by Stephen Darlington <sd...@apache.org>.
The most straightforward answer might just be to create views in
your source database. Out of the box, the cache store is really designed
for a 1:1 mapping between table and cache. You *can* do more complex
mappings, but it may require coding.

On Wed, 6 Sept 2023 at 09:46, Bram Biesbrouck <
bram.biesbrouck@reinvention.be> wrote:

> Hi all,
>
> I've been experimenting with Ignite over the past months and took an
> unexpected (pleasant) deep dive.
>
> Right now, I'm fiddling around with write-through and read-through, but
> I'm stuck on one feature I'd really want to find a solution for database
> table discriminator values and mapping them to a polymorph class hierarchy.
>
> In a way, I'm looking for an Ignite alternative to JPA's
> @DiscriminatorColumn
> <https://docs.oracle.com/javaee%2F7%2Fapi%2F%2F/javax/persistence/DiscriminatorColumn.html>
> annotation that creates different classes from records with different
> column constants. Or just something similar. Documentation or examples of
> support for polymorphism in general maybe?
>
> I've started using low level configuration with JdbcType, QueryEntity and
> complex keys, but I can't seem to find an acceptable solution to load
> database records (from a single table) into different caches (or a single
> cache with different binaries of distinct classes).
>
> Any help or pointers in the right direction?
> Do I need to write a custom Marchaller maybe?
>
> b.
> <http://www.reinvention.be> *Creative engineering & inventions*
> Check our latest projects! <http://www.reinvention.be> *Bram Biesbrouck*
> bram.biesbrouck@reinvention.be
> +32 486 118280 <0032%20486%20118280>
>