You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by "lttnd@yahoo.com" <lt...@yahoo.com> on 2006/04/26 05:48:50 UTC
inner join n:1 how to
I have two classes Product(table=product) and
ProductGroup(table=productgroup) ; these two tables are n:1 relationship
means 1 row on productgroup may has more than 1 rows on 'produc' table .
I want to query to get all fields of product table and 2 field of
productgroup table with some conditions for example
select product.id , product.name, product.price , product.productgroupid ,
productgroup.name, productgroup.logo from product a inner join productgroup
b on a.productgroupid = b.id .
How can i do this with ojb
thank in advanced ,
Regards
--
View this message in context: http://www.nabble.com/inner-join-n%3A1-how-to-t1509312.html#a4094471
Sent from the Apache DB - ObjectRelationalBridge Users forum at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: inner join n:1 how to
Posted by Armin Waibel <ar...@apache.org>.
Hi,
lttnd@yahoo.com wrote:
> Normally , if i use QueryByCriteria q =
> QueryFactory.newQuery(ProductImpl.class, criteria); and criteria contained
> some ProductGroup conditions ; and then i will retrieve all data of
> ProductImpl that product table outter join with ProductGroup table . May be
> in this case i HAVE to use ReportQuery ?
>
I'm not a query expert, but I think you are right. If you want to mix
columns of different tables (/objects) you can't use the object based
criteria api.
You can find an example here
http://db.apache.org/ojb/docu/guides/query.html#Report+Queries
regards,
Armin
> Thank in advanced ,
> Regards
> --
> View this message in context: http://www.nabble.com/inner-join-n%3A1-how-to-t1509312.html#a4133579
> Sent from the Apache DB - ObjectRelationalBridge Users forum at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: inner join n:1 how to
Posted by "lttnd@yahoo.com" <lt...@yahoo.com>.
Normally , if i use QueryByCriteria q =
QueryFactory.newQuery(ProductImpl.class, criteria); and criteria contained
some ProductGroup conditions ; and then i will retrieve all data of
ProductImpl that product table outter join with ProductGroup table . May be
in this case i HAVE to use ReportQuery ?
Thank in advanced ,
Regards
--
View this message in context: http://www.nabble.com/inner-join-n%3A1-how-to-t1509312.html#a4133579
Sent from the Apache DB - ObjectRelationalBridge Users forum at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org