Neil,
I have been successfully doing queries of the form:
 SELECT j FROM Site WHERE parent.id = $1 or asset.containerSiteId.id = $1
where asset is a collection. However, I then decided that I only needed
either the count from the query or just the id of the object so I changed
the query to 
 SELECT COUNT(*) FROM Site WHERE parent.id = $1 or asset.containerSiteId.id
= $1
 SELECT j.id FROM Site WHERE parent.id = $1 or asset.containerSiteId.id = $1
and then got inaccurate results. I didn't have the time then to figure out
why, and instead did some pretty horrific hacking of the sql generated by
castor to do the query that I wanted. However, as long as I was looking for
the whole object, the results appeared to be accurate. 

You can't directly query the dependent objects since by definition a
dependent object can't exist outside the context of the object that it
depends on. What sort of results are you seeing when you do 

select m from Molecule.class m where m.atom.value=1

Also, what version of castor are you using? I'm still on the ancient 0.9.3.9
codeline -

-Margaret

-----Original Message-----
From: Neil Blue [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 21, 2002 5:56 AM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] query on dependant objects does not work?


Margaret,

Are you able to query the dependant objects in your model? This would be a
work around for me but that does not seem to work either.

Neil

-----Original Message-----
From: Martin, Margaret [mailto:[EMAIL PROTECTED]]
Sent: 20 November 2002 19:29
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] query on dependant objects does not work?


Neil,
Have you actually tried that oql (select m from Molecule.class m where
m.atom.value=1)? I've got very similar oql that I have been running
successfully - what are you seeing when you run it?

-Margaret

-----Original Message-----
From: Neil Blue [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 20, 2002 12:05 PM
To: [EMAIL PROTECTED]
Subject: [castor-dev] query on dependant objects does not work?


Hello,

I am trying to do a query on an object that is in a collection. I have read
that this is not possible with OQL. for example:

select m from Molecule.class m where m.atom.value=1

this will not work where atom is a collection. So I am trying to query
against the atom directly:

select a from Atom.class a where a.value=1

but castor does not let me do this if the Atom.class is a dependant class on
Molecule in the mapping.xml, saying that it can not find a mapping for the
class Atom.

So I take the dependancy off of the Atom class, and now when I load
instances of the Molecule class, they no longer have Atoms attached to them.

Please could someone tell me if this is supposed to be the case, and if
there is a way for me to query against dependant classes.

Thank you 
Neil Blue

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to