After migration to 3.0.5 I've got my only method using query.scroll() that fails, giving an NPE:
It was working well before and I don't see any error in the HQL.
stacktrace:
Code:
java.lang.NullPointerException: null
at org.hibernate.hql.ast.HqlSqlWalker.createFromJoinElement(HqlSqlWalker.java:264)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3022)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:2841)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2719)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:513)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:371)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:201)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:151)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
at org.hibernate.impl.SessionImpl.scroll(SessionImpl.java:954)
at org.hibernate.impl.QueryImpl.scroll(QueryImpl.java:62)
at org.hibernate.impl.QueryImpl.scroll(QueryImpl.java:52)
at org.xx.common.persistence.BaseDAOHibernate$18.doInHibernate(BaseDAOHibernate.java:617)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:312)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:288)
at org.xx.common.persistence.BaseDAOHibernate.getResultList(BaseDAOHibernate.java:611)
at org.xx.dotation.persistence.DotationDAOHibernate.searchMouvementsDotations(DotationDAOHibernate.java:54)
at org.xx.dotation.service.DotationServiceImpl.searchFromCriteria(DotationServiceImpl.java:118)
The generated failing HQL query is:
Quote:
select distinct MouvementDotation.id, DotationDepart.dotationCode, DotationArrivee.dotationCode, User.id, MouvementDotation.mouvementDotationMontant, MouvementDotation.mouvementDotationDateCreation, TypeMouvementDotation.typeMouvementDotationLibelle, MouvementDotation.mouvementDotationEnveloppeCodeFk from org.xx.common.model.dotation.MouvementDotation MouvementDotation left outer join MouvementDotation.mouvementDotationDotationIdFk1 as DotationDepart left join MouvementDotation.mouvementDotationDotationIdFk2 as DotationArrivee left join MouvementDotation.mouvementDotationUserCodeFk as User left join MouvementDotation.mouvementDotationTypeMouvementDotationCodeFk as TypeMouvementDotation left join MouvementDotation.mouvementDotationEnveloppeCodeFk as Enveloppe where MouvementDotation.mouvementDotationTypeMouvementDotationCodeFk = TypeMouvementDotation.id AND (TypeMouvementDotation.id like '%') AND ((DotationDepart.dotationCode like '%%') OR (DotationArrivee.dotationCode like '%%')) AND (MouvementDotation.mouvementDotationDateCreation between '01/01/1900'and '01/01/3000' ) ORDER BY MouvementDotation.id desc,MouvementDotation.mouvementDotationDateCreation desc
The tedious mappings, seems compulsory:
Code:
<class name="org.xx.common.model.dotation.Dotation" table="DOTATION" lazy="true">
<meta attribute="extends" inherit="false">org.xx.common.persistence.BusinessObject</meta>
<cache usage="read-write"/>
<id name="id" column="DOTATION_ID" type="java.lang.Long">
<generator class="identity"/>
</id>
<property name="dotationCode" column="DOTATION_CODE" type="java.lang.String" not-null="true"/>
<property name="dotationLibelle" column="DOTATION_LIBELLE" type="java.lang.String" not-null="true"/>
<property name="dotationMontantEnveloppeObligatoire" column="DOTATION_MONTANT_ENVELOPPE_OBLIGATOIRE" type="java.lang.Double" not-null="true"/>
<property name="dotationMontantEnveloppeComplementaire" column="DOTATION_MONTANT_ENVELOPPE_COMPLEMENTAIRE" type="java.lang.Double" not-null="true"/>
<property name="dotationBudgetObligatoire" column="DOTATION_BUDGET_OBLIGATOIRE" type="java.lang.Double" not-null="true"/>
<property name="dotationBudgetComplementaire" column="DOTATION_BUDGET_COMPLEMENTAIRE" type="java.lang.Double" not-null="true"/>
<property name="dotationDateCreation" column="DOTATION_DATE_CREATION" type="java.util.Date" not-null="true"/>
<property name="dotationDateMaj" column="DOTATION_DATE_MAJ" type="java.util.Date" not-null="true"/>
<property name="dotationEtatActivation" column="DOTATION_ETAT_ACTIVATION" type="java.lang.Byte" not-null="true"/>
<property name="dotationDateSuppression" column="DOTATION_DATE_SUPPRESSION" type="java.util.Date"/>
<many-to-one name="dotationUserCodeFk" column="DOTATION_UTILISATEUR_CODE_FK" class="org.xx.common.model.user.User" not-null="true"/>
<many-to-one name="dotationRegroupementProfessionCodeFk" column="DOTATION_REGROUPEMENT_PROFESSION_CODE_FK" class="org.xx.common.model.profession.RegroupementProfession" not-null="true"/>
<many-to-one name="dotationTypeDotationCodeFk" column="DOTATION_TYPE_DOTATION_CODE_FK" class="org.xx.common.model.dotation.TypeDotation" not-null="true"/>
</class>
<class name="org.xx.common.model.dotation.MouvementDotation" table="MOUVEMENT_DOTATION">
<meta attribute="extends" inherit="false">org.xx.common.persistence.BusinessObject</meta>
<cache usage="read-write"/>
<id name="id" column="MOUVEMENT_DOTATION_ID" type="java.lang.Long">
<generator class="identity"/>
</id>
<property name="mouvementDotationMontant" column="MOUVEMENT_DOTATION_MONTANT" type="java.lang.Double" not-null="true"/>
<property name="mouvementDotationExerciceVersement" column="MOUVEMENT_DOTATION_EXERCICE_VERSEMENT" type="java.lang.Short" not-null="true"/>
<property name="mouvementDotationDateCreation" column="MOUVEMENT_DOTATION_DATE_CREATION" type="java.util.Date" not-null="true"/>
<property name="mouvementDotationEnveloppeCodeFk" column="MOUVEMENT_DOTATION_ENVELOPPE_CODE_FK" type="java.lang.String" not-null="true"/>
<many-to-one name="mouvementDotationDotationIdFk1" column="MOUVEMENT_DOTATION_DOTATION_ID_FK1" class="org.xx.common.model.dotation.Dotation" cascade="none" unique="false" fetch="join" update="true" insert="true"/>
<many-to-one name="mouvementDotationDotationIdFk2" column="MOUVEMENT_DOTATION_DOTATION_ID_FK2" class="org.xx.common.model.dotation.Dotation" cascade="none" unique="false" fetch="join" update="true" insert="true"/>
<many-to-one name="mouvementDotationTypeMouvementDotationCodeFk" column="MOUVEMENT_DOTATION_TYPE_MOUVEMENT_DOTATION_CODE_FK" class="org.xx.common.model.dotation.TypeMouvementDotation" cascade="none"/>
<many-to-one name="mouvementDotationUserCodeFk" column="MOUVEMENT_DOTATION_UTILISATEUR_CODE_FK" class="org.xx.common.model.user.User" cascade="none" fetch="join"/>
</class>
<class name="org.xx.common.model.dotation.TypeMouvementDotation" table="TYPE_MOUVEMENT_DOTATION" mutable="false">
<meta attribute="extends" inherit="false">org.xx.common.persistence.BusinessObject</meta>
<cache usage="read-only"/>
<id name="id" column="TYPE_MOUVEMENT_DOTATION_CODE" type="java.lang.String">
<generator class="assigned"/>
</id>
<property name="typeMouvementDotationLibelle" column="TYPE_MOUVEMENT_DOTATION_LIBELLE" type="java.lang.String" not-null="true"/>
<property name="typeMouvementDotationEtatActivation" column="TYPE_MOUVEMENT_DOTATION_ETAT_ACTIVATION" type="java.lang.Byte" not-null="true"/>
</class>
<class name="org.xx.common.model.profession.Enveloppe" table="ENVELOPPE" mutable="false">
<meta attribute="extends" inherit="false">org.xx.common.persistence.BusinessObject</meta>
<cache usage="read-only"/>
<id name="id" column="ENVELOPPE_CODE" type="java.lang.String">
<generator class="assigned"/>
</id>
<property name="enveloppeLibelle" column="ENVELOPPE_LIBELLE" type="java.lang.String"/>
<property name="enveloppeEtatPriseEnChargeTva" column="ENVELOPPE_ETAT_PRISE_EN_CHARGE_TVA" type="java.lang.Byte"/>
</class>