Bonjour,

Je cherche en Toplink à écrire la requête suivante:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
SELECT ldsit.ID_LOG_DELIVERY_SITE,
  ldsit.VERSION_NUMBER,
  ldsit.DESCRIPTION,
  ldsit.REF_AGENCY_ID,
  ldsit.ID_BUSINESS
FROM LOG_DELIVERY_SITE ldsit
WHERE (select count(*) from ref_label) > 
  (SELECT count(*)
  FROM LOG_SHUTTLE shuttle,
    REL_SHUTTLE_DEL_SITE_LABEL rel
  WHERE (((rel.LOG_DELIVERY_SITE_ID = ldsit.ID_LOG_DELIVERY_SITE)
  AND (shuttle.IS_SHIPPING              = 0))
  AND (shuttle.ID_LOG_SHUTTLE           = rel.LOG_SHUTTLE_ID))
Je bataille depuis ce matin sans aucun résultat...

Voici mon code pour l'instant:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 
//For the query
        ExpressionBuilder theExpBuild = new ExpressionBuilder();
 
        //For the subquery count
        ExpressionBuilder theExpCountBuild = new ExpressionBuilder();
 
        ReportQuery subQueryCount = new ReportQuery(FrameLabel.class, theExpCountBuild);
        subQueryCount.addCount("nblabelRef", theExpCountBuild.get("aLabelId").distinct());
 
        //For the subquery filter
        ExpressionBuilder theSubExpBuild = new ExpressionBuilder();
        Expression expShuttle = theSubExpBuild.get("shuttle");
        Expression expShuttleIsShipping = expShuttle.get("m_bIsShipping").equal(isShipping);
        Expression expRelation = theSubExpBuild.get("aDeliverySiteId").equal(theExpBuild.get("m_lDeliverySiteId"));
 
        //subquery filter
        ReportQuery subQueryFilter = new ReportQuery(RelShuttleDeliverySiteLabel.class, expRelation);
        subQueryFilter.refreshIdentityMapResult();
        subQueryFilter.addCount("countRel", theSubExpBuild.get("aLabelId"));
 
        subQueryFilter.setSelectionCriteria(expRelation.and(expShuttleIsShipping));
 
        //query
        Expression greaterThanExp = theExpCountBuild.value("nblabelRef").greaterThan(theExpCountBuild.value("countRel"));
        //Expression notExistExp = theExpBuild.get("m_lDeliverySiteId").notExists(subQueryFilter);
 
        ReadAllQuery theQuery = new ReadAllQuery(DeliverySite.class, greaterThanExp);
 
 
        theQuery.addBatchReadAttribute("m_RelLabels");
        List  lstDeliverySite = (List) CustomSessionManager.instance().getSession().executeQuery(theQuery);
 
 
        return getMementoArrayFromList(lstDeliverySite);
Quelqu'un aurait une piste??