You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metamodel.apache.org by Arunkumar Pillai <ar...@gmail.com> on 2015/12/04 11:19:54 UTC

How to use joins using apache meta modes

Please help in executing the following queries

SELECT a.id as ID,
     a.a_name as a_NAME ,b.user_name
     FROM TB_a a inner join TB_b b on b.id = a.id
     WHERE a.active = 1


I'm not finding any examples for joins
or directly converting the sql queries to meta model query

-- 
Thanks and Regards
        Arun

Re: How to use joins using apache meta modes

Posted by Arunkumar Pillai <ar...@gmail.com>.
Thanks for the response and it worked for me.

On Sun, Dec 6, 2015 at 7:12 PM, Tomasz Guziałek <to...@guzialek.info>
wrote:

> True. I have always used the version with WHERE clause, so completely
> missed innerJoin, leftJoin and rightJoin:
>
> dataContext.query().from("tableA").innerJoin("tableB").on("columnFromA",
> "columnFromB").selectAll().execute();
>
> Pozdrawiam / Regards / Med venlig hilsen
> Tomasz Guziałek
>
> 2015-12-06 12:39 GMT+01:00 Kasper Sørensen <i.am.kasper.sorensen@gmail.com
> >:
>
> > Well, a first-class join is also possible. Just use the query API... I'm
> > not even sure what the question is here Arunkumar??
> >
> > 2015-12-05 23:41 GMT+01:00 Tomasz Guziałek <to...@guzialek.info>:
> >
> > > Hello Arunkumar,
> > >
> > > MetaModel does not have specialialized constructs for JOIN operations.
> > Try
> > > writing your query in such a manner:
> > >
> > >
> > >
> >
> dataContext.query().from("tableA").and("tableB").selectAll().where("joinColumnFromA").eq("joinColumnFromB").executeQuery();
> > >
> > > Pozdrawiam / Regards / Med venlig hilsen
> > > Tomasz Guziałek
> > >
> > > 2015-12-04 11:19 GMT+01:00 Arunkumar Pillai <ar...@gmail.com>:
> > >
> > > > Please help in executing the following queries
> > > >
> > > > SELECT a.id as ID,
> > > >      a.a_name as a_NAME ,b.user_name
> > > >      FROM TB_a a inner join TB_b b on b.id = a.id
> > > >      WHERE a.active = 1
> > > >
> > > >
> > > > I'm not finding any examples for joins
> > > > or directly converting the sql queries to meta model query
> > > >
> > > > --
> > > > Thanks and Regards
> > > >         Arun
> > > >
> > >
> >
>



-- 
Thanks and Regards
        Arun

Re: How to use joins using apache meta modes

Posted by Tomasz Guziałek <to...@guzialek.info>.
True. I have always used the version with WHERE clause, so completely
missed innerJoin, leftJoin and rightJoin:

dataContext.query().from("tableA").innerJoin("tableB").on("columnFromA",
"columnFromB").selectAll().execute();

Pozdrawiam / Regards / Med venlig hilsen
Tomasz Guziałek

2015-12-06 12:39 GMT+01:00 Kasper Sørensen <i....@gmail.com>:

> Well, a first-class join is also possible. Just use the query API... I'm
> not even sure what the question is here Arunkumar??
>
> 2015-12-05 23:41 GMT+01:00 Tomasz Guziałek <to...@guzialek.info>:
>
> > Hello Arunkumar,
> >
> > MetaModel does not have specialialized constructs for JOIN operations.
> Try
> > writing your query in such a manner:
> >
> >
> >
> dataContext.query().from("tableA").and("tableB").selectAll().where("joinColumnFromA").eq("joinColumnFromB").executeQuery();
> >
> > Pozdrawiam / Regards / Med venlig hilsen
> > Tomasz Guziałek
> >
> > 2015-12-04 11:19 GMT+01:00 Arunkumar Pillai <ar...@gmail.com>:
> >
> > > Please help in executing the following queries
> > >
> > > SELECT a.id as ID,
> > >      a.a_name as a_NAME ,b.user_name
> > >      FROM TB_a a inner join TB_b b on b.id = a.id
> > >      WHERE a.active = 1
> > >
> > >
> > > I'm not finding any examples for joins
> > > or directly converting the sql queries to meta model query
> > >
> > > --
> > > Thanks and Regards
> > >         Arun
> > >
> >
>

Re: How to use joins using apache meta modes

Posted by Arunkumar Pillai <ar...@gmail.com>.
Thanks. I got the answer for the join. My second part was is that there any
api anyways that we can execute query directly
On 06-Dec-2015 17:09, "Kasper Sørensen" <i....@gmail.com>
wrote:

> Well, a first-class join is also possible. Just use the query API... I'm
> not even sure what the question is here Arunkumar??
>
> 2015-12-05 23:41 GMT+01:00 Tomasz Guziałek <to...@guzialek.info>:
>
> > Hello Arunkumar,
> >
> > MetaModel does not have specialialized constructs for JOIN operations.
> Try
> > writing your query in such a manner:
> >
> >
> >
> dataContext.query().from("tableA").and("tableB").selectAll().where("joinColumnFromA").eq("joinColumnFromB").executeQuery();
> >
> > Pozdrawiam / Regards / Med venlig hilsen
> > Tomasz Guziałek
> >
> > 2015-12-04 11:19 GMT+01:00 Arunkumar Pillai <ar...@gmail.com>:
> >
> > > Please help in executing the following queries
> > >
> > > SELECT a.id as ID,
> > >      a.a_name as a_NAME ,b.user_name
> > >      FROM TB_a a inner join TB_b b on b.id = a.id
> > >      WHERE a.active = 1
> > >
> > >
> > > I'm not finding any examples for joins
> > > or directly converting the sql queries to meta model query
> > >
> > > --
> > > Thanks and Regards
> > >         Arun
> > >
> >
>

Re: How to use joins using apache meta modes

Posted by Kasper Sørensen <i....@gmail.com>.
Well, a first-class join is also possible. Just use the query API... I'm
not even sure what the question is here Arunkumar??

2015-12-05 23:41 GMT+01:00 Tomasz Guziałek <to...@guzialek.info>:

> Hello Arunkumar,
>
> MetaModel does not have specialialized constructs for JOIN operations. Try
> writing your query in such a manner:
>
>
> dataContext.query().from("tableA").and("tableB").selectAll().where("joinColumnFromA").eq("joinColumnFromB").executeQuery();
>
> Pozdrawiam / Regards / Med venlig hilsen
> Tomasz Guziałek
>
> 2015-12-04 11:19 GMT+01:00 Arunkumar Pillai <ar...@gmail.com>:
>
> > Please help in executing the following queries
> >
> > SELECT a.id as ID,
> >      a.a_name as a_NAME ,b.user_name
> >      FROM TB_a a inner join TB_b b on b.id = a.id
> >      WHERE a.active = 1
> >
> >
> > I'm not finding any examples for joins
> > or directly converting the sql queries to meta model query
> >
> > --
> > Thanks and Regards
> >         Arun
> >
>

Re: How to use joins using apache meta modes

Posted by Tomasz Guziałek <to...@guzialek.info>.
Hello Arunkumar,

MetaModel does not have specialialized constructs for JOIN operations. Try
writing your query in such a manner:

dataContext.query().from("tableA").and("tableB").selectAll().where("joinColumnFromA").eq("joinColumnFromB").executeQuery();

Pozdrawiam / Regards / Med venlig hilsen
Tomasz Guziałek

2015-12-04 11:19 GMT+01:00 Arunkumar Pillai <ar...@gmail.com>:

> Please help in executing the following queries
>
> SELECT a.id as ID,
>      a.a_name as a_NAME ,b.user_name
>      FROM TB_a a inner join TB_b b on b.id = a.id
>      WHERE a.active = 1
>
>
> I'm not finding any examples for joins
> or directly converting the sql queries to meta model query
>
> --
> Thanks and Regards
>         Arun
>