HQL Queries - multiple objects
Hi all, I was wondering, is it possible to use a single query to get document details and specified linked objects using one query (specific fields of those objects would be even better)? For example, A document is created using a class template. Inside the document are used two other classes, which are used multiple times. One of those classes is used for critical information that needs to be shown in the document listing. Currently what I do is to return a query based on the class for documents, then loop through those results for document names. Inside each loop I'm performing a second loop for the class with critical information (shown in the listing). This eventually results in some fairly heavy traffic (as you could imagine), which I'd like to resolve. Not sure if this description is clear enough, but any suggestions or idea's would be welcome! Brandon Esbach Software Engineer M/A-Com Eurotec Operations LoughMahon Technology Park, Skehard Road, Blackrock, Cork, Ireland Tel +353 21 4808305
Hi, i'm not sure if it's what you want. the code below search every page which contains a class "XWiki.CandidatClass" except the page "XWiki.CandidatClassTemplate" and have a property status=$status. #macro (showCandidat $status) #set ($sql = ", BaseObject as obj, StringProperty as prop where obj.name=doc.fullName and obj.className='XWiki.CandidatClass' and obj.name<>'XWiki.CandidatClassTemplate' and obj.id=prop.id.id and prop.id.name='status' and prop.value='$status' order by prop.value desc") #foreach ($item in $xwiki.searchDocuments($sql)) #set($bentrydoc = $xwiki.getDocument($item)) #set($bentryobj = $bentrydoc.getObject("XWiki.CandidatClass")) 1.1.1 [$bentrydoc.display("name","view", $bentryobj)>$bentrydoc.FullName] #end #end Is it what you mean? Jérémi On 4/20/06, Esbach, Brandon <[email protected]> wrote:
Hi all,
I was wondering, is it possible to use a single query to get document details and specified linked objects using one query (specific fields of those objects would be even better)?
For example, A document is created using a class template. Inside the document are used two other classes, which are used multiple times.
One of those classes is used for critical information that needs to be shown in the document listing. Currently what I do is to return a query based on the class for documents, then loop through those results for document names. Inside each loop I'm performing a second loop for the class with critical information (shown in the listing). This eventually results in some fairly heavy traffic (as you could imagine), which I'd like to resolve.
Not sure if this description is clear enough, but any suggestions or idea's would be welcome!
Brandon Esbach Software Engineer M/A-Com Eurotec Operations LoughMahon Technology Park, Skehard Road, Blackrock, Cork, Ireland Tel +353 21 4808305
-- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
-- Blog: http://www.jeremi.info LinkedIn: https://www.linkedin.com/profile?viewProfile=&key=1437724 Project Manager XWiki: http://www.xwiki.org skype: jeremi23 -- msn et gtalk : [email protected]
participants (2)
-
Esbach, Brandon -
jeremi joslin