Bonjour ,
j'essaie decrire la requete suivante avec hibernate 3
mais ça passe pas:
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
 
	/**
         * method used to get the merchant services not already using service templates with the given Message Template code 
         * @param session
         * @param code (the Message Template code)
         * @throws DAOException
         * @return MerchantService collection
         */
	public static Collection findNotAssociatedMerchantServicesFromCode (Session session,String code)throws DAOException {
		Collection results = null;
		Transaction tx = null;
		Query query = null;
		StringBuffer str = null;
		try {
			if(logger.isDebugEnabled())
				logger.debug("findNotAssociatedMerchantServicesFromCode : start le code de la template: " + code);
//			str = new StringBuffer();
//			str.append("SELECT tpa.profile FROM TemplateProfileAssociation tpa");
//			str.append("WHERE parentTemplate.code="+code);
			if(logger.isDebugEnabled())
				logger.debug("ecrire la requete");
			str = new StringBuffer();
			str.append("SELECT  ms FROM MerchantService ms");
			str.append("WHERE ms.merchant.profile IN (");
			str.append("SELECT profile FROM TemplateProfileAssociation tpa ");
			str.append("WHERE tpa.parentTemplate.code="+code+")");
 
//			str.append("SELECT MsgTemplate tmpl FROM TemplateProfileAssociation");
//			str.append(" WHERE profile.name=t.merchantService.merchant.profile.name)");
			//session
		    tx = session.beginTransaction();
			if(logger.isDebugEnabled())
				logger.debug("transaction");
			query = session.createQuery(str.toString());			
			query.setCacheable(true);
			if(logger.isDebugEnabled())
				logger.debug("je récupère le résultat");
 
            results = query.list();
 
            if(logger.isDebugEnabled())
				logger.debug("je commite");
			tx.commit();
 
			return results;
 
		} catch(Exception e) {
			tx.rollback();
			throw new DAOException(e);
		} finally {
			if(logger.isDebugEnabled())
				logger.debug("findNotAssociatedMerchantServicesFromCode : results=" + results.toString());
		}
 
	}
}
j'attend votre réponse
Thanks a lot