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 Helder Gaspar Rodrigues <hm...@netcabo.pt> on 2006/04/13 08:23:20 UTC

Im desperated

Hello everyone, i know that maybe this ml is not the appropriate local
to ask this, but im so desperated that i have to try.

Im using OJB in a java project, and now i want to query the objects
using odmg OQL query.

Imagine class A and B. A has a set of B objets assigned into the
variable bs.

B object have a variable called date with type java.util.Date;

I want to retrieve all objects A that not match with the variable date
in all objects B in the set bs.

Example:

String oqlQuery = "select a from " + A.class.getName();
oqlQuery += " where name = $1 and bs.data <> $2";


the problem is if there is any B in the bs that do not match the "<>"
the respective object A that contains that B object is putted in the result.

I dont want that, i want: If there is any B in the bs set that match
"<>" object A is not considerated.


Any tips?

Thank you a lot for your attention!

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


Re: Im desperated

Posted by Bruno CROS <br...@gmail.com>.
i'm affraid you cannot compare 2 different types. I think SQL ca'nt and
else, it's not recommended.

If you have realised your query in SQL, compare it with the SQL query
produced by your OQL query  ( help with P6spy ) and you will find what goes
wrong.

Regards

On 4/13/06, Helder Gaspar Rodrigues <hm...@netcabo.pt> wrote:
>
> i tinhk that i have understaood your point of view, but how can i
> compare A with B if they are diferents object types?
>
> Thank you
> Bruno CROS wrote:
> > Take in consideration fields with null value. Test <> ou = cannot be
> > correctly done with nulls.
> >
> > In this case you have to write : A isNull OR A<>B
> >
> > or A NotNULL AND A==B
> >
> > Hope this may help you.
> >
> > Regards.
> >
> >
> > On 4/13/06, Helder Gaspar Rodrigues <hm...@netcabo.pt> wrote:
> >> Hello everyone, i know that maybe this ml is not the appropriate local
> >> to ask this, but im so desperated that i have to try.
> >>
> >> Im using OJB in a java project, and now i want to query the objects
> >> using odmg OQL query.
> >>
> >> Imagine class A and B. A has a set of B objets assigned into the
> >> variable bs.
> >>
> >> B object have a variable called date with type java.util.Date;
> >>
> >> I want to retrieve all objects A that not match with the variable date
> >> in all objects B in the set bs.
> >>
> >> Example:
> >>
> >> String oqlQuery = "select a from " + A.class.getName();
> >> oqlQuery += " where name = $1 and bs.data <> $2";
> >>
> >>
> >> the problem is if there is any B in the bs that do not match the "<>"
> >> the respective object A that contains that B object is putted in the
> >> result.
> >>
> >> I dont want that, i want: If there is any B in the bs set that match
> >> "<>" object A is not considerated.
> >>
> >>
> >> Any tips?
> >>
> >> Thank you a lot for your attention!
> >>
> >> ---------------------------------------------------------------------
> >> 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: Im desperated

Posted by Helder Gaspar Rodrigues <hm...@netcabo.pt>.
i tinhk that i have understaood your point of view, but how can i
compare A with B if they are diferents object types?

Thank you
Bruno CROS wrote:
> Take in consideration fields with null value. Test <> ou = cannot be
> correctly done with nulls.
> 
> In this case you have to write : A isNull OR A<>B
> 
> or A NotNULL AND A==B
> 
> Hope this may help you.
> 
> Regards.
> 
> 
> On 4/13/06, Helder Gaspar Rodrigues <hm...@netcabo.pt> wrote:
>> Hello everyone, i know that maybe this ml is not the appropriate local
>> to ask this, but im so desperated that i have to try.
>>
>> Im using OJB in a java project, and now i want to query the objects
>> using odmg OQL query.
>>
>> Imagine class A and B. A has a set of B objets assigned into the
>> variable bs.
>>
>> B object have a variable called date with type java.util.Date;
>>
>> I want to retrieve all objects A that not match with the variable date
>> in all objects B in the set bs.
>>
>> Example:
>>
>> String oqlQuery = "select a from " + A.class.getName();
>> oqlQuery += " where name = $1 and bs.data <> $2";
>>
>>
>> the problem is if there is any B in the bs that do not match the "<>"
>> the respective object A that contains that B object is putted in the
>> result.
>>
>> I dont want that, i want: If there is any B in the bs set that match
>> "<>" object A is not considerated.
>>
>>
>> Any tips?
>>
>> Thank you a lot for your attention!
>>
>> ---------------------------------------------------------------------
>> 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: Im desperated

Posted by Bruno CROS <br...@gmail.com>.
Take in consideration fields with null value. Test <> ou = cannot be
correctly done with nulls.

In this case you have to write : A isNull OR A<>B

or A NotNULL AND A==B

Hope this may help you.

Regards.


On 4/13/06, Helder Gaspar Rodrigues <hm...@netcabo.pt> wrote:
>
> Hello everyone, i know that maybe this ml is not the appropriate local
> to ask this, but im so desperated that i have to try.
>
> Im using OJB in a java project, and now i want to query the objects
> using odmg OQL query.
>
> Imagine class A and B. A has a set of B objets assigned into the
> variable bs.
>
> B object have a variable called date with type java.util.Date;
>
> I want to retrieve all objects A that not match with the variable date
> in all objects B in the set bs.
>
> Example:
>
> String oqlQuery = "select a from " + A.class.getName();
> oqlQuery += " where name = $1 and bs.data <> $2";
>
>
> the problem is if there is any B in the bs that do not match the "<>"
> the respective object A that contains that B object is putted in the
> result.
>
> I dont want that, i want: If there is any B in the bs set that match
> "<>" object A is not considerated.
>
>
> Any tips?
>
> Thank you a lot for your attention!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>

Re: RE : Im desperated

Posted by Helder Gaspar Rodrigues <hm...@netcabo.pt>.
Im converting the object from database:
<field-descriptor name="data" column="DATA" jdbc-type="DATE"
conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDateFieldConversion"/>

I can make the query in standard SQL but no in OQL.

Imagine two objects in bs, one is diferente from $2 and the other is
equal to $2.

with the query it puts the object A in the result because the first
object of the bs set is diferrent as i want it, but the second is equal.

Because the second is equal to $2 the object A goes to the result list,
and I dont want that. I just want the A objects that dont have B objects
with the date variable equal to $2.

Thank you a lot.

Nicolas DELAHAYE wrote:
> I have you tred with java.sql.Date ?
> 
> Best regards
> Nicolas DELAHAYE
> 
> -----Message d'origine-----
> De : Helder Gaspar Rodrigues [mailto:hmgr@netcabo.pt] 
> Envoyé : jeudi 13 avril 2006 08:23
> À : ojb-user@db.apache.org
> Objet : Im desperated
> 
> 
> Hello everyone, i know that maybe this ml is not the appropriate local
> to ask this, but im so desperated that i have to try.
> 
> Im using OJB in a java project, and now i want to query the objects
> using odmg OQL query.
> 
> Imagine class A and B. A has a set of B objets assigned into the
> variable bs.
> 
> B object have a variable called date with type java.util.Date;
> 
> I want to retrieve all objects A that not match with the variable date
> in all objects B in the set bs.
> 
> Example:
> 
> String oqlQuery = "select a from " + A.class.getName(); oqlQuery += "
> where name = $1 and bs.data <> $2";
> 
> 
> the problem is if there is any B in the bs that do not match the "<>"
> the respective object A that contains that B object is putted in the
> result.
> 
> I dont want that, i want: If there is any B in the bs set that match
> "<>" object A is not considerated.
> 
> 
> Any tips?
> 
> Thank you a lot for your attention!
> 
> ---------------------------------------------------------------------
> 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
> 


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


RE : Im desperated

Posted by Nicolas DELAHAYE <de...@laposte.net>.
I have you tred with java.sql.Date ?

Best regards
Nicolas DELAHAYE

-----Message d'origine-----
De : Helder Gaspar Rodrigues [mailto:hmgr@netcabo.pt] 
Envoyé : jeudi 13 avril 2006 08:23
À : ojb-user@db.apache.org
Objet : Im desperated


Hello everyone, i know that maybe this ml is not the appropriate local
to ask this, but im so desperated that i have to try.

Im using OJB in a java project, and now i want to query the objects
using odmg OQL query.

Imagine class A and B. A has a set of B objets assigned into the
variable bs.

B object have a variable called date with type java.util.Date;

I want to retrieve all objects A that not match with the variable date
in all objects B in the set bs.

Example:

String oqlQuery = "select a from " + A.class.getName(); oqlQuery += "
where name = $1 and bs.data <> $2";


the problem is if there is any B in the bs that do not match the "<>"
the respective object A that contains that B object is putted in the
result.

I dont want that, i want: If there is any B in the bs set that match
"<>" object A is not considerated.


Any tips?

Thank you a lot for your attention!

---------------------------------------------------------------------
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