Using JOIN with HQL function in NHibernate?

3

I'm trying to run a JOIN using HQL with NHibernate and returns an empty list. How to do this?

I'm trying like this.

[Serializable]
public class Cliente {
    public virtual int id               { set; get; }
    public virtual string nome          { set; get; }
    public virtual string cpf           { set; get; }
    public virtual DateTime nascimento  { set; get; }
}

[Serializable]
public class Conta {    
    public virtual long id                      { set; get; }
    public virtual Cliente cliente              { set; get; }
    public virtual String historico             { set; get; }
    public virtual DateTime dtLancamento        { set; get; }
    public virtual DateTime dtVencimento        { set; get; }
    public virtual decimal valorFinal           { set; get; }
}

DAO

//JOIN
public IList<Conta> findAllContasReceberAtiva() 
{
      ISession _session = getSession();
      IList<Conta> list = _session.CreateQuery("FROM Conta c " +
          " INNER JOIN c.cliente cli ON (c.cliente.id = cli.id) " +  
          " WHERE (c.tipoConta = 1) AND (c.status = 0) ORDER BY c.dtLancamento ")
         .List<Conta>();
      return list;    
}
    
asked by anonymous 21.09.2016 / 22:03

0 answers