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
| public ArrayList<Object> connexion(int numcompte, String codesecret){
// Déclaration de la variable de renvoi
ArrayList<Object> renvoi = new ArrayList<Object>();
renvoi.add(false);
// Requête HQL
Query q = em.createQuery("from Compte where numcompte = :numcompte");
q.setParameter("numcompte", numcompte);
// Vérification du nombre de résultats
if(q.getResultList().size() > 0)
{
Compte compte = (Compte)q.getSingleResult();
Client client = compte.getClient();
if(client.getCodesecret().equalsIgnoreCase((String)codesecret))
renvoi.set(0,true);
renvoi.add(compte);
}
return renvoi;
} |