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 Marco José <ma...@criticalsoftware.com> on 2004/06/09 16:41:13 UTC

select distinct field (with OJB)

Hi all,
 
Can anybody tell me in a few words how to execute the following SQL
(Oracle) instruction with OJB:
SELECT DISTINCT fieldname FROM tablename
 
I allready tried it with QueryBySQL QueryByCriteria and
ReportQueryByCriteria but it never worked.
 
Thank you in advance.
 
 
 
Marco José
 



--- This message may contain confidential information or privileged material, and is intended only for the individual(s) named. If you are not a named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. Critical Software.



Re: select distinct field (with OJB)

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi marco,

it's just an example ;)
the importatnt thing is the 'true' in QueryFactory.newQuery

hth
jakob

Marco José wrote:

> Hi Jakob,
> 
> I did not understand your answer. 
> What has the addLike method in the Criteria to do with a distinct query?
> 
> 
> 
> Marco José
> 
> 
> -----Original Message-----
> From: Jakob Braeuchi [mailto:jbraeuchi@gmx.ch] 
> Sent: sexta-feira, 11 de Junho de 2004 17:08
> To: OJB Users List
> Subject: Re: select distinct field (with OJB)
> 
> hi marco,
> 
> it's a flag in the query.
> 
> Criteria crit = new Criteria();
> crit.addLike("allArticlesInGroup.articleName", "C%");
> // distinct
> QueryByCriteria q = QueryFactory.newQuery(ProductGroup.class, crit,
> true);
> 
> 
> jakob
> 
> Marco José wrote:
> 
> 
>>Hi all,
>> 
>>Can anybody tell me in a few words how to execute the following SQL
>>(Oracle) instruction with OJB:
>>SELECT DISTINCT fieldname FROM tablename
>> 
>>I allready tried it with QueryBySQL QueryByCriteria and
>>ReportQueryByCriteria but it never worked.
>> 
>>Thank you in advance.
>> 
>> 
>> 
>>Marco José
>> 
>>
>>
>>
>>--- This message may contain confidential information or privileged
> 
> material, and is intended only for the individual(s) named. If you are
> not a named addressee you should not disseminate, distribute or copy
> this e-mail. Please notify the sender immediately by e-mail if you have
> received this e-mail by mistake and delete this e-mail from your system.
> E-mail transmission cannot be guaranteed to be secure or error-free as
> information could be intercepted, corrupted, lost, destroyed, arrive
> late or incomplete, or contain viruses. The sender therefore does not
> accept liability for any errors or omissions in the contents of this
> message which arise as a result of e-mail transmission. If verification
> is required please request a hard-copy version. Critical Software.
> 
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 
> 
> 
> --- This message may contain confidential information or privileged material, and is intended only for the individual(s) named. If you are not a named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. Critical Software.
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> 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: select distinct field (with OJB)

Posted by Marco José <ma...@criticalsoftware.com>.
Hi Jakob,

I did not understand your answer. 
What has the addLike method in the Criteria to do with a distinct query?



Marco José


-----Original Message-----
From: Jakob Braeuchi [mailto:jbraeuchi@gmx.ch] 
Sent: sexta-feira, 11 de Junho de 2004 17:08
To: OJB Users List
Subject: Re: select distinct field (with OJB)

hi marco,

it's a flag in the query.

Criteria crit = new Criteria();
crit.addLike("allArticlesInGroup.articleName", "C%");
// distinct
QueryByCriteria q = QueryFactory.newQuery(ProductGroup.class, crit,
true);


jakob

Marco José wrote:

> Hi all,
>  
> Can anybody tell me in a few words how to execute the following SQL
> (Oracle) instruction with OJB:
> SELECT DISTINCT fieldname FROM tablename
>  
> I allready tried it with QueryBySQL QueryByCriteria and
> ReportQueryByCriteria but it never worked.
>  
> Thank you in advance.
>  
>  
>  
> Marco José
>  
> 
> 
> 
> --- This message may contain confidential information or privileged
material, and is intended only for the individual(s) named. If you are
not a named addressee you should not disseminate, distribute or copy
this e-mail. Please notify the sender immediately by e-mail if you have
received this e-mail by mistake and delete this e-mail from your system.
E-mail transmission cannot be guaranteed to be secure or error-free as
information could be intercepted, corrupted, lost, destroyed, arrive
late or incomplete, or contain viruses. The sender therefore does not
accept liability for any errors or omissions in the contents of this
message which arise as a result of e-mail transmission. If verification
is required please request a hard-copy version. Critical Software.
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org





--- This message may contain confidential information or privileged material, and is intended only for the individual(s) named. If you are not a named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. Critical Software.




Re: select distinct field (with OJB)

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi marco,

it's a flag in the query.

Criteria crit = new Criteria();
crit.addLike("allArticlesInGroup.articleName", "C%");
// distinct
QueryByCriteria q = QueryFactory.newQuery(ProductGroup.class, crit, true);


jakob

Marco José wrote:

> Hi all,
>  
> Can anybody tell me in a few words how to execute the following SQL
> (Oracle) instruction with OJB:
> SELECT DISTINCT fieldname FROM tablename
>  
> I allready tried it with QueryBySQL QueryByCriteria and
> ReportQueryByCriteria but it never worked.
>  
> Thank you in advance.
>  
>  
>  
> Marco José
>  
> 
> 
> 
> --- This message may contain confidential information or privileged material, and is intended only for the individual(s) named. If you are not a named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. Critical Software.
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org