You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Bastien Durel <ba...@data.fr> on 2020/07/21 08:16:40 UTC

third-party persistance and junction table

Hello,

I have a junction table in my model, and used the web console to
generate ignite config and classes from my SQL database

-> There is a table user with id (long) and some data
-> There is a table role with id (long) and some data
-> There is a table user_role with user_id (fk) and role_id (fk)

Reading cache from table works, I can query ignite with jdbc and I get
my relations as expected.

But if I want to add a new relation, the query :
insert into "UserRoleCache".user_role(USER_ID, ROLE_ID) values(6003, 2)
is translated into this one, sent to postgresql :
UPDATE public.user_role SET  WHERE (user_id=$1 AND role_id=$2)

Which obviously is rejected.

The web console generated a cache for this table, with UserRole
& UserRoleKey types, which each contains userId and roleId Long's.

Is there a better (correct) way to handle these many-to-many relations
in ignite (backed by RDBMS) ?

Regards,

-- 
Bastien Durel
DATA
Intégration des données de l'entreprise,
Systèmes d'information décisionnels.

bastien.durel@data.fr
tel : +33 (0) 1 57 19 59 28
fax : +33 (0) 1 57 19 59 73
12 avenue Raspail, 94250 GENTILLY France
www.data.fr


Re: third-party persistance and junction table

Posted by Bastien Durel <ba...@data.fr>.
Hello,

OK, so I'll stick with my "dummy char(1) column as value" hack.

Thanks,

Le jeudi 23 juillet 2020 à 17:41 +0300, Andrei Aleksandrov a écrit :
> Hi,
> 
> Unfortunately, Ignite doesn't support such kind of relations out of
> the 
> box. Ignite just translates it to third party data storage that used
> as 
> cache-store.
> 
> It's expected that inserts and updates will be rejected in case if
> they 
> break some rules.
> 
> BR,
> Andrei
> 7/21/2020 11:16 AM, Bastien Durel пишет:
> > Hello,
> > 
> > I have a junction table in my model, and used the web console to
> > generate ignite config and classes from my SQL database
> > 
> > -> There is a table user with id (long) and some data
> > -> There is a table role with id (long) and some data
> > -> There is a table user_role with user_id (fk) and role_id (fk)
> > 
> > Reading cache from table works, I can query ignite with jdbc and I
> > get
> > my relations as expected.
> > 
> > But if I want to add a new relation, the query :
> > insert into "UserRoleCache".user_role(USER_ID, ROLE_ID)
> > values(6003, 2)
> > is translated into this one, sent to postgresql :
> > UPDATE public.user_role SET  WHERE (user_id=$1 AND role_id=$2)
> > 
> > Which obviously is rejected.
> > 
> > The web console generated a cache for this table, with UserRole
> > & UserRoleKey types, which each contains userId and roleId Long's.
> > 
> > Is there a better (correct) way to handle these many-to-many
> > relations
> > in ignite (backed by RDBMS) ?
> > 
> > Regards,
> > 
-- 
Bastien Durel
DATA
Intégration des données de l'entreprise,
Systèmes d'information décisionnels.

bastien.durel@data.fr
tel : +33 (0) 1 57 19 59 28
fax : +33 (0) 1 57 19 59 73
12 avenue Raspail, 94250 GENTILLY France
www.data.fr


Re: third-party persistance and junction table

Posted by Andrei Aleksandrov <ae...@gmail.com>.
Hi,

Unfortunately, Ignite doesn't support such kind of relations out of the 
box. Ignite just translates it to third party data storage that used as 
cache-store.

It's expected that inserts and updates will be rejected in case if they 
break some rules.

BR,
Andrei
7/21/2020 11:16 AM, Bastien Durel пишет:
> Hello,
>
> I have a junction table in my model, and used the web console to
> generate ignite config and classes from my SQL database
>
> -> There is a table user with id (long) and some data
> -> There is a table role with id (long) and some data
> -> There is a table user_role with user_id (fk) and role_id (fk)
>
> Reading cache from table works, I can query ignite with jdbc and I get
> my relations as expected.
>
> But if I want to add a new relation, the query :
> insert into "UserRoleCache".user_role(USER_ID, ROLE_ID) values(6003, 2)
> is translated into this one, sent to postgresql :
> UPDATE public.user_role SET  WHERE (user_id=$1 AND role_id=$2)
>
> Which obviously is rejected.
>
> The web console generated a cache for this table, with UserRole
> & UserRoleKey types, which each contains userId and roleId Long's.
>
> Is there a better (correct) way to handle these many-to-many relations
> in ignite (backed by RDBMS) ?
>
> Regards,
>