Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Trier par attribut de collection jointe
PostPosted: Tue Feb 08, 2011 2:26 pm 
Newbie

Joined: Tue Feb 08, 2011 12:36 pm
Posts: 1
Bonjour,
J'ai un cas particulier que je ne comprends pas comment traiter.
Je cherche le moyen a trier les documents par la dernière opération correspondante a ce document.
La liste de documents récupérés contient au moine 3500 éléments donc cela me semble stupide de trier a cote d'appli.
Et je limite la collection par 10 ligne pour ne pas trop charger displaytag.

Code:
SELECT distinct d
FROM Document d, DocumentStatus status, EnvironmentStatus es , Operation op
WHERE d.status = status
   AND (d.environmentStatus IS NULL
      OR d.environmentStatus = es)
   AND op in elements(d.operationCollection)
   AND EXISTS (SELECT o
            FROM Operation o
            WHERE o.document = d
            AND o.dateOp = (SELECT MAX(oper.dateOp)
                        FROM Operation oper
                        WHERE oper.document = d)
            AND o.dateOp BETWEEN :dateTrmntFrom AND :dateTrmntTo)
   AND d.dateDocument <= :dateMsgTo
   AND (status IS NULL
      OR status.status = 'KO')
   AND (es IS NULL
      OR es.name = 'Test')
   AND op.dateOp=(SELECT MAX(oper.dateOp)
               FROM Operation oper
               WHERE oper.document = d)
ORDER BY op.dateOp DESC


Any proposition?
Excusez-moi pour mon français.
Merci d'avance


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.