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 Clóvis Wichoski <cl...@uol.com.br> on 2004/06/22 16:30:23 UTC
Best way to use OQL with PB
Hi,
I'm using PersistenceBroker and need use OQL only for selecting objects,
then I will use OQLQueryImpl, only to make the Query object for me, but
I have two issues in doubt:
1) Executing query with broker
...
OQLQueryImpl oql = new OQLQueryImpl(broker.getPBKey());
oql.create(sbOQL.toString());
Collection results = broker.getCollectionByQuery(oql.getQuery());
...
2) Executing query with OQLQueryImpl
...
OQLQueryImpl oql = new OQLQueryImpl(broker.getPBKey());
oql.create(sbOQL.toString());
ManageableCollection results = oql.execute();
...
Then the doubts are:
What is better approach issue 1, issue 2 or exists a better way?
Since I will use the PB for me the best is issue 1, but for future
compatibility don't be better to have a class QueryByOQL like QueryBySQL
or QueryByCriteria?
Is correct instancing OQLQueryImpl programmatically?
TIA
Clóvis
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Best way to use OQL with PB
Posted by Thomas Mahler <th...@web.de>.
Hi Clovis,
Clóvis Wichoski wrote:
> Hi,
>
> I'm using PersistenceBroker and need use OQL only for selecting objects,
> then I will use OQLQueryImpl, only to make the Query object for me, but
> I have two issues in doubt:
>
> 1) Executing query with broker
> ...
> OQLQueryImpl oql = new OQLQueryImpl(broker.getPBKey());
> oql.create(sbOQL.toString());
> Collection results = broker.getCollectionByQuery(oql.getQuery());
> ...
>
> 2) Executing query with OQLQueryImpl
> ...
> OQLQueryImpl oql = new OQLQueryImpl(broker.getPBKey());
> oql.create(sbOQL.toString());
> ManageableCollection results = oql.execute();
> ...
>
> Then the doubts are:
>
> What is better approach issue 1, issue 2 or exists a better way?
1 is faster, as 2 involves creating a dummy ODMG transaction and
registering all result object to that transaction.
I see no better way to do this.
>
> Since I will use the PB for me the best is issue 1, but for future
> compatibility don't be better to have a class QueryByOQL like QueryBySQL
> or QueryByCriteria?
I guess you are the first one to use oql queries with the PB API. So I
guess noone had the idea to write a "QueryByOql" class yet.
But, yes, it could be a nice wrapper to your 1) approach.
>
> Is correct instancing OQLQueryImpl programmatically?
I see no problems,
cheers,
Thomas
>
> TIA
>
> Clóvis
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> 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