Hello i have this HQL request and i have an error when I run it
My function:
public ProprietaireInt getProprietaireInt(String codeImmeuble, String annee) {
//Create connexion
Session session = getHibernateTemplate().getSessionFactory().getCurrentSession();
ProprietaireInt proprietaireInt = new ProprietaireInt();
try{
String query = "SELECT pi.siren,pi.codeSCI,pi.libSocieteInterne,pi.libSocieteNormalise,pi.codeDomainePilotage " +
"FROM ImmeubleFisc if" +
"JOIN proprietaireInt pi ON if.sirenProprietaire = pi.siren " +
"WHERE if.idImmeubleFisc.codeImmeuble = :codeImmeuble " +
"AND if.idImmeubleFisc.exerciceFiscal = :annee";
Query q = null;
q = session.createQuery(query);
q.setString("codeImmeuble", codeImmeuble);
q.setString("annee", annee);
proprietaireInt = (ProprietaireInt) q.uniqueResult();
session.flush();
}
catch (Exception e)
{
System.out.println(e.getMessage()+" "+e.getStackTrace());
}
return proprietaireInt;
}
My errror :
2010-08-02 12:12:22,081 ERROR
ast.ErrorCounter
(ErrorCounter.java:33) – line 1:156:
unexpected token: proprietaireInt
I am not sure if JOIN ON is supported (see HHH-16 and
HHH-620) but, assumingProprietaireIntis an entity, I guess theJOINclause should be (note the uppercase first letter):Also since you’re using projections (without a constructor expression), you’ll get a
Object[]as result and I don’t think the following will work:From the reference documentation:
See also