2011-02-18 5 views
1

Salut J'ai une requête mappée pour prendre un champ de date. Après la mise à niveau NHibernate 3, je suis l'erreur suivante:Problème étrange après la mise à niveau vers Nhibernate 3

could not execute query 
[ select a.agency_num, cd.comp_name, sd.sib_number, sd.sib_type_label, 
ad.add_line1, ad.add_line2, ad.add_line3, ad.add_line4, ad.post_code, 
ad.country_label 
from 
agency a, company_details cd, sib_dets sd, address ad 
where 
a.contact_ser = cd.contact_ser 
and a.contact_ser = sd.contact_ser 
and a.contact_ser = ad.contact_ser 
and a.current_ser = 10 
and a.start_date <= ? 
and (a.end_date is null or a.end_date >= ?) 
and cd.current_ser = 10 
and cd.start_date <= ? 
and (cd.end_date is null or cd.end_date >= ?) 
and sd.current_ser = 10 
and sd.start_date <= ? 
and (sd.end_date is null or sd.end_date >= ?) 
and ad.current_ser = 10 
and ad.start_date <= ? 
and (ad.end_date is null or ad.end_date >= ?) ] 
    Name:dateValid - Value:18/02/2011 00:00:00 
[SQL: select a.agency_num, cd.comp_name, sd.sib_number, 
sd.sib_type_label, 
ad.add_line1, ad.add_line2, ad.add_line3, ad.add_line4, ad.post_code, 
ad.country_label 
from 
agency a, company_details cd, sib_dets sd, address ad 
where 
a.contact_ser = cd.contact_ser 
and a.contact_ser = sd.contact_ser 
and a.contact_ser = ad.contact_ser 
and a.current_ser = 10 
and a.start_date <= ? 
and (a.end_date is null or a.end_date >= ?) 
and cd.current_ser = 10 
and cd.start_date <= ? 
and (cd.end_date is null or cd.end_date >= ?) 
and sd.current_ser = 10 
and sd.start_date <= ? 
and (sd.end_date is null or sd.end_date >= ?) 
and ad.current_ser = 10 
and ad.start_date <= ? 
and (ad.end_date is null or ad.end_date >= ?)] 

et l'exception interne est: { "Le IfxParameter avec 'p0' ParameterName est déjà contenue par ce IfxParameterCollection."}

Toute personne savoir pourquoi c'est? Il fonctionne très bien sous la version précédente sur NHibernate

Voici mon code NHibernate:

using (ISession session = NHibernateHelper.OpenSession(FACTORY_NAME)) 
    { 
    IQuery query = session.GetNamedQuery("GetAllAgents"); 
    query.SetDateTime("dateValid", dateValid.Date); 
    agents = query.List<AgencySearchData>(); 
    } 

et voici mon fichier de mapping:

 <?xml version="1.0" encoding="utf-8" ?> 
    <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" 
       assembly="SeiDomain" 
       namespace="Sei.Domain.Entity"> 
     <class name="AgencySearchData"> 
     <id name="AgencyNumber" column="agency_num"/> 
     <property name="Name" column="comp_name" /> 
     <property name="SibNumber" column="sib_number" /> 
     <property name="SibType" column="sib_type_label" /> 
     <property name="Address1" column="add_line1" /> 
     <property name="Address2" column="add_line2" /> 
     <property name="Address3" column="add_line3" /> 
     <property name="Address4" column="add_line4" /> 
     <property name="Postcode" column="post_code" /> 
     <property name="Country" column="country_label" /> 
     </class> 
     <sql-query name="GetAllAgents"> 
     <return alias="agencySearchData" class="AgencySearchData"/> 
     <![CDATA[select a.agency_num, cd.comp_name, sd.sib_number, 
    sd.sib_type_label, 
    ad.add_line1, ad.add_line2, ad.add_line3, ad.add_line4, ad.post_code, 
    ad.country_label 
    from 
    agency a, company_details cd, sib_dets sd, address ad 
    where 
    a.contact_ser = cd.contact_ser 
    and a.contact_ser = sd.contact_ser 
    and a.contact_ser = ad.contact_ser 
    and a.current_ser = 10 
    and a.start_date <= :dateValid 
    and (a.end_date is null or a.end_date >= :dateValid) 
    and cd.current_ser = 10 
    and cd.start_date <= :dateValid 
    and (cd.end_date is null or cd.end_date >= :dateValid) 
    and sd.current_ser = 10 
    and sd.start_date <= :dateValid 
    and (sd.end_date is null or sd.end_date >= :dateValid) 
    and ad.current_ser = 10 
    and ad.start_date <= :dateValid 
    and (ad.end_date is null or ad.end_date >= :dateValid)]]> 
     </sql-query> 
    </hibernate-mapping> 

Répondre

1

Je crois que cela pourrait être lié à NH-2529.

Vérifiez si le correctif fonctionne pour vous et votez pour celui-ci.

Questions connexes