ok, this is the code:
Code:
public IList Find(string query)
{
try
{
IEnumerable enumerable = Session.Enumerable(query);
Collection collection = new Collection(enumerable);
return collection;
}
catch(Exception e)
{
CloseAndReOpen();
throw e;
}
}
Hbm file:
Code:
<?xml version="1.0"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" default-access="field">
<class name="MyProject.BOL.MArticulo, MyProject.BOL" table="MArticulo" persister="MyProject.DAL.CustomPersister, MyProject.DAL" lazy="false">
<jcs-cache usage="read-write" />
<id name="Id" column="Id" type="Guid" unsaved-value="{00000000-0000-0000-0000-000000000000}">
<generator class="guid" />
</id>
<version name="version" column="version" type="Int32" />
<property name="codigo" column="codigo" type="String" length="50" />
<property name="descripcion" column="descripcion" type="String" length="150" />
<property name="unidadMedidaPeso" column="unidadMedidaPeso" type="String" length="50" />
<property name="pesoStock" column="pesoStock" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="cantidadStock" column="cantidadStock" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<set name="lineasEntrega_nh" lazy="true" cascade="save-update">
<key>
<column name="IdMArticulo" />
</key>
<one-to-many class="MyProject.BOL.LineaEntrega, MyProject.BOL" />
</set>
<set name="previsionesRecepcion_nh" lazy="true" cascade="all">
<key>
<column name="IdMArticulo" />
</key>
<one-to-many class="MyProject.BOL.PrevisionRecepcion, MyProject.BOL" />
</set>
<property name="userc" column="userc" type="String" length="80" />
<property name="hostc" column="hostc" type="String" length="80" />
<property name="datec" column="datec" type="DateTime" />
<property name="usera" column="usera" type="String" length="80" />
<property name="hosta" column="hosta" type="String" length="80" />
<property name="datea" column="datea" type="DateTime" />
<set name="proveedores_nh" table="proveedores_nh_mArticulos_nh" lazy="true" inverse="true" cascade="save-update">
<key>
<column name="idMArticulos_nh" />
</key>
<many-to-many class="MyProject.BOL.Proveedor, MyProject.BOL" column="idProveedores_nh" />
</set>
<joined-subclass name="MyProject.BOL.MConsumible, MyProject.BOL" table="MConsumible" lazy="false">
<key column="Id" />
<joined-subclass name="MyProject.BOL.MBobina, MyProject.BOL" table="MBobina" lazy="true">
<key column="Id" />
<property name="gramaje" column="gramaje" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="hornos" column="hornos" type="Boolean" />
<property name="caras" column="caras" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" />
<property name="ancho" column="ancho" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="diametro" column="diametro" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<many-to-one name="mTipoPapel" column="idMTipoPapel" class="MyProject.BOL.MTipoPapel, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="colorPapel" column="idColorPapel" class="MyProject.BOL.ColorPapel, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="acabadoPapel" column="idAcabadoPapel" class="MyProject.BOL.AcabadoPapel, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="tipoPastaPapel" column="idTipoPastaPapel" class="MyProject.BOL.TipoPastaPapel, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="blancuraPapel" column="idBlancuraPapel" class="MyProject.BOL.BlancuraPapel, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="clasePapel" column="idClasePapel" class="MyProject.BOL.ClasePapel, MyProject.BOL" cascade="save-update" not-null="false" />
</joined-subclass>
<joined-subclass name="MyProject.BOL.MCajaCarton, MyProject.BOL" table="MCajaCarton" lazy="true">
<key column="Id" />
<property name="ancho" column="ancho" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="alto" column="alto" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="largo" column="largo" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="color" column="color" type="String" length="50" />
<property name="impresa" column="impresa" type="Boolean" />
<property name="tintas" column="tintas" type="String" length="50" />
<property name="canales" column="canales" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" />
<property name="nCaras" column="nCaras" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" />
<many-to-one name="tipoCaja" column="idTipoCaja" class="MyProject.BOL.TipoCaja, MyProject.BOL" cascade="save-update" not-null="false" />
</joined-subclass>
<joined-subclass name="MyProject.BOL.MCola, MyProject.BOL" table="MCola" lazy="true">
<key column="Id" />
</joined-subclass>
<joined-subclass name="MyProject.BOL.MContenedorSoporte, MyProject.BOL" table="MContenedorSoporte" lazy="true">
<key column="Id" />
<property name="ancho" column="ancho" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="largo" column="largo" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="alto" column="alto" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
</joined-subclass>
<joined-subclass name="MyProject.BOL.MHoja, MyProject.BOL" table="MHoja" lazy="true">
<key column="Id" />
<property name="gramaje" column="gramaje" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="hornos" column="hornos" type="Boolean" />
<property name="caras" column="caras" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" />
<property name="ancho" column="ancho" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="largo" column="largo" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<many-to-one name="mTipoPapel" column="idMTipoPapel" class="MyProject.BOL.MTipoPapel, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="colorPapel" column="idColorPapel" class="MyProject.BOL.ColorPapel, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="acabadoPapel" column="idAcabadoPapel" class="MyProject.BOL.AcabadoPapel, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="formato" column="idFormato" class="MyProject.BOL.Formato, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="tipoPastaPapel" column="idTipoPastaPapel" class="MyProject.BOL.TipoPastaPapel, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="blancuraPapel" column="idBlancuraPapel" class="MyProject.BOL.BlancuraPapel, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="fibras" column="idFibras" class="MyProject.BOL.Fibras, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="clasePapel" column="idClasePapel" class="MyProject.BOL.ClasePapel, MyProject.BOL" cascade="save-update" not-null="false" />
</joined-subclass>
<joined-subclass name="MyProject.BOL.MPaletSoporte, MyProject.BOL" table="MPaletSoporte" lazy="true">
<key column="Id" />
<property name="ancho" column="ancho" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="largo" column="largo" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="alto" column="alto" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="peso" column="peso" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<many-to-one name="tipoPalet" column="idTipoPalet" class="MyProject.BOL.TipoPalet, MyProject.BOL" cascade="save-update" not-null="false" />
</joined-subclass>
<joined-subclass name="MyProject.BOL.MPlancha, MyProject.BOL" table="MPlancha" lazy="true">
<key column="Id" />
<property name="ancho" column="ancho" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" />
<property name="largo" column="largo" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" />
<property name="espesor" column="espesor" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="material" column="material" type="String" length="50" />
</joined-subclass>
<joined-subclass name="MyProject.BOL.MPolietileno, MyProject.BOL" table="MPolietileno" lazy="true">
<key column="Id" />
<property name="espesor" column="espesor" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="gramaje" column="gramaje" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="ancho" column="ancho" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="diametro" column="diametro" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="impreso" column="impreso" type="Boolean" />
<many-to-one name="tipoPolietileno" column="idTipoPolietileno" class="MyProject.BOL.TipoPolietileno, MyProject.BOL" cascade="save-update" not-null="false" />
</joined-subclass>
<joined-subclass name="MyProject.BOL.MTinta, MyProject.BOL" table="MTinta" lazy="true">
<key column="Id" />
<property name="tipoImpresion" column="tipoImpresion" type="String" length="50" />
<property name="horno" column="horno" type="Boolean" />
<many-to-one name="color" column="idColor" class="MyProject.BOL.Color, MyProject.BOL" cascade="save-update" not-null="false" />
</joined-subclass>
</joined-subclass>
<joined-subclass name="MyProject.BOL.TProducto, MyProject.BOL" table="TProducto" lazy="false">
<key column="Id" />
<property name="pesoUnitario" column="pesoUnitario" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="cantidadProducida" column="cantidadProducida" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="cantidadPrevista" column="cantidadPrevista" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<many-to-one name="mProducto" column="idMProducto" class="MyProject.BOL.MProducto, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="revision" column="idRevision" class="MyProject.BOL.Revision, MyProject.BOL" cascade="save-update" not-null="false" />
<set name="cantidadesEntrada_nh" lazy="true" inverse="true" cascade="all-delete-orphan">
<key>
<column name="idTProductoEntrada" />
</key>
<one-to-many class="MyProject.BOL.CantidadEntrada, MyProject.BOL" />
</set>
<set name="cantidadesSalida_nh" lazy="true" inverse="true" cascade="all-delete-orphan">
<key>
<column name="idTProductoSalida" />
</key>
<one-to-many class="MyProject.BOL.CantidadSalida, MyProject.BOL" />
</set>
<joined-subclass name="MyProject.BOL.TEmbalaje, MyProject.BOL" table="TEmbalaje" lazy="false">
<key column="Id" />
<property name="grosorPlastico" column="grosorPlastico" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="nflejesXZ" column="nflejesXZ" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" />
<property name="nflejesYZ" column="nflejesYZ" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" />
<property name="nflejesXY" column="nflejesXY" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" />
<property name="ancho" column="ancho" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="largo" column="largo" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="alto" column="alto" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<many-to-one name="tipoFlejado" column="idTipoFlejado" class="MyProject.BOL.TipoFlejado, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="tipoPlastico" column="idTipoPlastico" class="MyProject.BOL.TipoPlastico, MyProject.BOL" cascade="save-update" not-null="false" />
<joined-subclass name="MyProject.BOL.TCaja, MyProject.BOL" table="TCaja" lazy="true">
<key column="Id" />
<many-to-one name="mCajaCarton" column="idMCajaCarton" class="MyProject.BOL.MCajaCarton, MyProject.BOL" cascade="save-update" not-null="false" />
<set name="tPosCajas_nh" lazy="true" inverse="true" cascade="save-update">
<key>
<column name="idTCaja" />
</key>
<one-to-many class="MyProject.BOL.TPosCaja, MyProject.BOL" />
</set>
</joined-subclass>
<joined-subclass name="MyProject.BOL.TContenedor, MyProject.BOL" table="TContenedor" lazy="true">
<key column="Id" />
<many-to-one name="mContenedorSoporte" column="idMContenedorSoporte" class="MyProject.BOL.MContenedorSoporte, MyProject.BOL" cascade="save-update" not-null="false" />
<set name="tPosContenedores_nh" lazy="true" inverse="true" cascade="all-delete-orphan">
<key>
<column name="idTContenedor" />
</key>
<one-to-many class="MyProject.BOL.TPosContenedor, MyProject.BOL" />
</set>
</joined-subclass>
<joined-subclass name="MyProject.BOL.TEncartado, MyProject.BOL" table="TEncartado" lazy="true">
<key column="Id" />
<many-to-one name="tEjemplar" column="idTEjemplar" class="MyProject.BOL.TEjemplar, MyProject.BOL" cascade="save-update" not-null="false" />
<set name="tPosEncartados_nh" lazy="true" inverse="true" cascade="all-delete-orphan">
<key>
<column name="idTEncartado" />
</key>
<one-to-many class="MyProject.BOL.TPosEncartado, MyProject.BOL" />
</set>
</joined-subclass>
<joined-subclass name="MyProject.BOL.TPalet, MyProject.BOL" table="TPalet" lazy="true">
<key column="Id" />
<property name="boinas" column="boinas" type="Boolean" />
<property name="cartonIntermedio" column="cartonIntermedio" type="Boolean" />
<property name="tapas" column="tapas" type="Boolean" />
<property name="tipoTapas" column="tipoTapas" type="String" length="50" />
<property name="nVueltas" column="nVueltas" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" />
<property name="numUnidadesBase" column="numUnidadesBase" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" />
<property name="numEjemplaresUnidad" column="numEjemplaresUnidad" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" />
<property name="numAlturas" column="numAlturas" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" />
<many-to-one name="mPaletSoporteCliente" column="idMPaletSoporteCliente" class="MyProject.BOL.MPaletSoporte, MyProject.BOL" cascade="save-update" not-null="false" />
<set name="tPosPalets_nh" lazy="true" inverse="true" cascade="all-delete-orphan">
<key>
<column name="idTPalet" />
</key>
<one-to-many class="MyProject.BOL.TPosPalet, MyProject.BOL" />
</set>
</joined-subclass>
<joined-subclass name="MyProject.BOL.TPaquete, MyProject.BOL" table="TPaquete" lazy="true">
<key column="Id" />
<set name="tPosPaquetes_nh" lazy="true" inverse="true" cascade="all-delete-orphan">
<key>
<column name="idTPaquete" />
</key>
<one-to-many class="MyProject.BOL.TPosPaquete, MyProject.BOL" />
</set>
</joined-subclass>
</joined-subclass>
<joined-subclass name="MyProject.BOL.TProductoEncuadernable, MyProject.BOL" table="TProductoEncuadernable" lazy="false">
<key column="Id" />
<property name="sangrePagina" column="sangrePagina" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="fresaPagina" column="fresaPagina" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="anchoNecesarioPagina" column="anchoNecesarioPagina" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="gramaje" column="gramaje" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="ordenEnSeccion" column="ordenEnSeccion" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" />
<many-to-one name="formato" column="idFormato" class="MyProject.BOL.Formato, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="tipoPlegado" column="idTipoPlegado" class="MyProject.BOL.TipoPlegado, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="tipoTrepado" column="idTipoTrepado" class="MyProject.BOL.TipoTrepado, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="tipoTroquelado" column="idTipoTroquelado" class="MyProject.BOL.TipoTroquelado, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="tipoTinta" column="idTipoTinta" class="MyProject.BOL.TipoTinta, MyProject.BOL" cascade="save-update" not-null="false" />
<set name="tLibros_nh" table="tProductosEncuadernables_nh_tLibros_nh" lazy="true" inverse="true" cascade="save-update">
<key>
<column name="idTProductosEncuadernables_nh" />
</key>
<many-to-many class="MyProject.BOL.TLibro, MyProject.BOL" column="idTLibros_nh" />
</set>
<joined-subclass name="MyProject.BOL.TCubierta, MyProject.BOL" table="TCubierta" lazy="true">
<key column="Id" />
<property name="lomoPreimpresion" column="lomoPreimpresion" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<many-to-one name="tipoBarnizCara" column="idTipoBarnizCara" class="MyProject.BOL.TipoBarniz, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="tipoBarnizRetira" column="idTipoBarnizRetira" class="MyProject.BOL.TipoBarniz, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="acabadoCubierta" column="idAcabadoCubierta" class="MyProject.BOL.AcabadoCubierta, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="formatoSolapaDelantera" column="idFormatoSolapaDelantera" class="MyProject.BOL.Formato, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="formatoSolapaTrasera" column="idFormatoSolapaTrasera" class="MyProject.BOL.Formato, MyProject.BOL" cascade="save-update" not-null="false" />
</joined-subclass>
<joined-subclass name="MyProject.BOL.TEncarte, MyProject.BOL" table="TEncarte" lazy="true">
<key column="Id" />
<property name="solapa" column="solapa" type="Boolean" />
<many-to-one name="tipoBarnizCara" column="idTipoBarnizCara" class="MyProject.BOL.TipoBarniz, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="tipoBarnizRetira" column="idTipoBarnizRetira" class="MyProject.BOL.TipoBarniz, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="formatoSolapa" column="idFormatoSolapa" class="MyProject.BOL.Formato, MyProject.BOL" cascade="save-update" not-null="false" />
</joined-subclass>
<joined-subclass name="MyProject.BOL.TPliego, MyProject.BOL" table="TPliego" lazy="true">
<key column="Id" />
<property name="nPliego" column="nPliego" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" />
<many-to-one name="tipoDePlegado" column="idTipoDePlegado" class="MyProject.BOL.TipoPlegado, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="formatoEjemplar" column="idFormatoEjemplar" class="MyProject.BOL.Formato, MyProject.BOL" cascade="save-update" not-null="false" />
</joined-subclass>
</joined-subclass>
<joined-subclass name="MyProject.BOL.TEjemplar, MyProject.BOL" table="TEjemplar" lazy="false">
<key column="Id" />
<property name="titulo" column="titulo" type="String" length="50" />
<property name="tiradaTotal" column="tiradaTotal" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="fechaIniEntregas" column="fechaIniEntregas" type="Nullables.NHibernate.NullableDateTimeType, Nullables.NHibernate" />
<property name="fechaFinEntregas" column="fechaFinEntregas" type="Nullables.NHibernate.NullableDateTimeType, Nullables.NHibernate" />
<property name="pieImprenta" column="pieImprenta" type="String" length="50" />
<property name="depositoLegal" column="depositoLegal" type="String" length="50" />
<property name="muestra" column="muestra" type="Boolean" />
<property name="fechaTopeEntregaMuestras" column="fechaTopeEntregaMuestras" type="Nullables.NHibernate.NullableDateTimeType, Nullables.NHibernate" />
<property name="nMuestrasEmbalaje" column="nMuestrasEmbalaje" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" />
<property name="pesoTeorico" column="pesoTeorico" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="suministradoCliente" column="suministradoCliente" type="Boolean" />
<property name="ancho" column="ancho" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="largo" column="largo" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<many-to-one name="tipoMuestras" column="idTipoMuestras" class="MyProject.BOL.TipoMuestras, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="tipoProducto" column="idTipoProducto" class="MyProject.BOL.TipoProducto, MyProject.BOL" cascade="save-update" not-null="false" />
<set name="tEncartados_nh" lazy="true" inverse="true" cascade="save-update">
<key>
<column name="idTEjemplar" />
</key>
<one-to-many class="MyProject.BOL.TEncartado, MyProject.BOL" />
</set>
<joined-subclass name="MyProject.BOL.TLibro, MyProject.BOL" table="TLibro" lazy="false">
<key column="Id" />
<property name="guardas" column="guardas" type="Boolean" />
<property name="tapaDura" column="tapaDura" type="Boolean" />
<property name="lomoEstimado" column="lomoEstimado" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<set name="tProductosEncuadernables_nh" table="tProductosEncuadernables_nh_tLibros_nh" lazy="true" inverse="false" cascade="save-update">
<key>
<column name="idTLibros_nh" />
</key>
<many-to-many class="MyProject.BOL.TProductoEncuadernable, MyProject.BOL" column="idTProductosEncuadernables_nh" />
</set>
<set name="secciones_nh" lazy="true" inverse="true" cascade="all-delete-orphan">
<key>
<column name="idTLibro" />
</key>
<one-to-many class="MyProject.BOL.Seccion, MyProject.BOL" />
</set>
<joined-subclass name="MyProject.BOL.TSuplemento, MyProject.BOL" table="TSuplemento" lazy="true">
<key column="Id" />
</joined-subclass>
</joined-subclass>
</joined-subclass>
<joined-subclass name="MyProject.BOL.TFichero, MyProject.BOL" table="TFichero" lazy="true">
<key column="Id" />
<property name="tamanho" column="tamanho" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="nPaginas" column="nPaginas" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" />
<property name="cMYK" column="cMYK" type="Boolean" />
<property name="fechaRecepcion" column="fechaRecepcion" type="Nullables.NHibernate.NullableDateTimeType, Nullables.NHibernate" />
<property name="fechaRevision" column="fechaRevision" type="Nullables.NHibernate.NullableDateTimeType, Nullables.NHibernate" />
<property name="nRevision" column="nRevision" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" />
<many-to-one name="resolucionFichero" column="idResolucionFichero" class="MyProject.BOL.ResolucionFichero, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="soporte" column="idSoporte" class="MyProject.BOL.SoporteFichero, MyProject.BOL" cascade="save-update" not-null="false" />
</joined-subclass>
<joined-subclass name="MyProject.BOL.THojaImpresa, MyProject.BOL" table="THojaImpresa" lazy="true">
<key column="Id" />
<property name="gramaje" column="gramaje" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<many-to-one name="tipoBarnizCara" column="idTipoBarnizCara" class="MyProject.BOL.TipoBarniz, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="tipoBarnizRetira" column="idTipoBarnizRetira" class="MyProject.BOL.TipoBarniz, MyProject.BOL" cascade="save-update" not-null="false" />
<many-to-one name="formato" column="idFormato" class="MyProject.BOL.Formato, MyProject.BOL" cascade="save-update" not-null="false" />
</joined-subclass>
<joined-subclass name="MyProject.BOL.TPlancha, MyProject.BOL" table="TPlancha" lazy="true">
<key column="Id" />
<property name="ancho" column="ancho" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="largo" column="largo" type="Nullables.NHibernate.NullableDoubleType, Nullables.NHibernate" />
<property name="resolucion" column="resolucion" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" />
<property name="lineatura" column="lineatura" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" />
<property name="angulacion" column="angulacion" type="Nullables.NHibernate.NullableInt32Type, Nullables.NHibernate" />
<property name="decoraciones" column="decoraciones" type="Boolean" />
<property name="corondeles" column="corondeles" type="Boolean" />
<property name="pPF" column="pPF" type="Nullables.NHibernate.NullableDateTimeType, Nullables.NHibernate" />
</joined-subclass>
</joined-subclass>
</class>
</hibernate-mapping>
and I have the problem in the following part of code:
Code:
string consulta = "from MConsumible m ";
MyProject.Collections.Set lista = new MyProject.Collections.Set();
foreach(MConsumible _mconsumible in DAL.DB.CurrentSession().Find(consulta))
{
if (((_mconsumible is MBobina) && (this.cbConsumiblebobinas.Checked ))
|| ((_mconsumible is MHoja) && (this.cbConsumibleHojas.Checked ))
|| ((_mconsumible is MPlancha) && (this.cbConsumiblePlanchas.Checked ))
|| ((_mconsumible is MTinta) && (this.cbConsumibleTintas.Checked ))
|| ((_mconsumible is MPolietileno) && (this.cbConsumiblePolietileno.Checked ))
|| ((_mconsumible is BOL.MCajaCarton) && (this.cbConsumibleCajas.Checked ))
|| ((_mconsumible is MCola) && (this.cbConsumibleColas.Checked ))
|| ((_mconsumible is BOL.MContenedorSoporte) && (this.cbConsumibleSopContenedor.Checked ))
|| ((_mconsumible is MPaletSoporte) && (this.cbConsumibleSopPalet.Checked )))
lista.Add(_mconsumible);
}
when lazy=true, lista is empty, but when lazy = false, the collection lista has data
In my class definition I have a custom persister that fill the public collections when they are created. Maybe, I have an error in this method and for that reason i do not create the objects of the collection with the correct type.
I am going to try to create a similar structure, but without the wrappers and without my custom methods, and then I