I may have missed something, but what makes you think it's the DateTime
field? I can't see anything in the exception that mentions it.
Have you tried reducing your table and model (removing fields/properties)
until you're able to stop it from occurring?

On Sat, Mar 7, 2009 at 5:17 PM, dacanetdev <[email protected]>wrote:

>
> Sorry, I don't want to bother you Fabio, just I'm really desesperate
> and now I can't get that fixed and I will have to go back to Data
> centric approach that I wouldn't want to do. I have my project with
> too much tables with DateTime columns
>
> Sorry if I changed the subject I just saw the option and I thought it
> is ok to use that functionality.
>
> Thanks,
>
> On Mar 7, 11:04 am, Fabio Maulo <[email protected]> wrote:
> > "URGENT" is something I don't understand if it is not accomplished with
> > money.
> >
> > 2009/3/7 dacanetdev <[email protected]>
> >
> >
> >
> >
> >
> > > The type originally is datetime I also tried changing it to
> > > smalldatetime, didn't work. I'm really desesperate need to deliver
> > > some results I tried to change the property to be string but same bad
> > > result.
> >
> > > Any help would be appreciated.
> >
> > > Thanks,
> >
> > > On Mar 7, 9:35 am, James Gregory <[email protected]> wrote:
> > > > What is the type of your column?
> >
> > > > On Sat, Mar 7, 2009 at 3:26 PM, dacanetdev <
> [email protected]
> > > >wrote:
> >
> > > > > No I don't have a NULL I have only 1 record with this value
> 07/03/2009
> > > > > 07:56:51 a.m.
> >
> > > > > I read that the problem is that NHibernate can't get miliseconds
> > > > > therefore it can't cast to DateTime. As I said I tried with
> Timestamp
> > > > > with same result.
> >
> > > > > Thanks,
> >
> > > > > On Mar 7, 9:20 am, Ken Egozi <[email protected]> wrote:
> > > > > > is it possible that you have a null value in the DB? (so it can't
> get
> > > > > casted
> > > > > > to dateTime?)
> > > > > > if so - either fix the DB (add NOT NULL constraint and fix the
> data)
> > > or
> > > > > use
> > > > > > a nullable datetime for the property
> >
> > > > > > On Sat, Mar 7, 2009 at 5:07 PM, dacanetdev <
> > > [email protected]
> > > > > >wrote:
> >
> > > > > > > I'm getting this error, could you please help me with this?
> >
> > > > > > > The problem is with the property FechaCreacion that it's a
> > > DateTime. I
> > > > > > > tried with Timestamp and also as string, still getting the
> error.
> >
> > > > > > > Thanks for your help
> >
> > > > > > > This is the error
> >
> > > > > > > NHibernate.PropertyAccessException: Invalid Cast (check your
> > > mapping
> > > > > > > for property type mismatches); setter of
> > > > > > > JCES.ControlObra.Entities.Obra --->
> System.InvalidCastException:
> > > > > > > Specified cast is not valid.
> > > > > > > at (Object , Object[] , SetterCallback )
> > > > > > > at
> > > NHibernate.Bytecode.Lightweight.AccessOptimizer.SetPropertyValues
> > > > > > > (Object target, Object[] values)
> > > > > > > at
> >
> > >
> NHibernate.Tuple.Entity.PocoEntityTuplizer.SetPropertyValuesWithOptimizer
> > > > > > > (Object entity, Object[] values)
> >
> > > > > > > This is de Mapping file
> >
> > > > > > > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
> > > > > > > assembly="JCES.ControlObra.Entities"
> > > > > > > namespace="JCES.ControlObra.Entities">
> > > > > > >        <class
> > > > > > > name="JCES.ControlObra.Entities.Obra,JCES.ControlObra.Entities"
> > > > > > > table="Obra">
> > > > > > >                <id name="ObraId" column="ObraId" type="Int32"
> > > > > > > unsaved-value="0">
> > > > > > >                        <generator class="native" />
> > > > > > >                </id>
> > > > > > >                <property name="NumObra" column="NumObra"
> > > type="string"
> > > > > > > length="50"
> > > > > > > not-null="true" unique="true" />
> > > > > > >                <property name="NombreObra" column="NombreObra"
> > > > > > > type="string"
> > > > > > > length="400" not-null="true" />
> > > > > > >                <property name="FechaCreacion"
> > > column="FechaCreacion"
> > > > > > > type="DateTime" not-null="true" />
> > > > > > >                <property name="CostoEstatal"
> column="CostoEstatal"
> > > > > > > type="Decimal"
> > > > > > > not-null="false" />
> > > > > > >                <property name="CostoFederal"
> column="CostoFederal"
> > > > > > > type="Decimal"
> > > > > > > not-null="false" />
> > > > > > >                <property name="CostoOtros" column="CostoOtros"
> > > > > > > type="Decimal" not-
> > > > > > > null="false" />
> >
> > > > > > >                <many-to-one name="Municipio"  class="Municipio"
> > > > > > > column="MunicipioId" />
> > > > > > >                <many-to-one name="Localidad"  class="Localidad"
> > > > > > > column="LocalidadId" />
> > > > > > >                <many-to-one name="TipoObra"  class="TipoObra"
> > > > > > > column="TipoObraId" /
> >
> > > > > > >        </class>
> > > > > > > </hibernate-mapping>
> >
> > > > > > > This is the class
> >
> > > > > > > public class Obra
> > > > > > >    {
> >
> > > > > > >        private int obraId;
> > > > > > >        private string numObra;
> > > > > > >        private string nombreObra;
> > > > > > >        private TipoObra tipoObra;
> > > > > > >        private DateTime fechaCreacion;
> > > > > > >        private Localidad localidad;
> > > > > > >        private Municipio municipio;
> > > > > > >        private double costoEstatal;
> > > > > > >        private double costoFederal;
> > > > > > >        private double costoOtros;
> >
> > > > > > >        public Obra()
> > > > > > >        {
> >
> > > > > > >        }
> >
> > > > > > >        public virtual int ObraId
> > > > > > >        {
> > > > > > >            get
> > > > > > >            {
> > > > > > >                return obraId;
> > > > > > >            }
> > > > > > >            set
> > > > > > >            {
> > > > > > >                obraId = value;
> > > > > > >            }
> > > > > > >        }
> >
> > > > > > >        public virtual string NumObra
> > > > > > >        {
> > > > > > >            get
> > > > > > >            {
> > > > > > >                return numObra;
> > > > > > >            }
> > > > > > >            set
> > > > > > >            {
> > > > > > >                numObra = value;
> > > > > > >            }
> > > > > > >        }
> >
> > > > > > >        public virtual string NombreObra
> > > > > > >        {
> > > > > > >            get
> > > > > > >            {
> > > > > > >                return nombreObra;
> > > > > > >            }
> > > > > > >            set
> > > > > > >            {
> > > > > > >                nombreObra = value;
> > > > > > >            }
> > > > > > >        }
> >
> > > > > > >        public virtual TipoObra TipoObra
> > > > > > >        {
> > > > > > >            get
> > > > > > >            {
> > > > > > >                return tipoObra;
> > > > > > >            }
> > > > > > >            set
> > > > > > >            {
> > > > > > >                tipoObra = value;
> > > > > > >            }
> > > > > > >        }
> >
> > > > > > >        public virtual Municipio Municipio
> > > > > > >        {
> > > > > > >            get
> > > > > > >            {
> > > > > > >                return municipio;
> > > > > > >            }
> > > > > > >            set
> > > > > > >            {
> > > > > > >                municipio = value;
> > > > > > >            }
> > > > > > >        }
> >
> > > > > > >        public virtual Localidad Localidad
> > > > > > >        {
> > > > > > >            get
> > > > > > >            {
> > > > > > >                return localidad;
> > > > > > >            }
> > > > > > >            set
> > > > > > >            {
> > > > > > >                localidad = value;
> > > > > > >            }
> > > > > > >        }
> >
> > > > > > >        public virtual DateTime FechaCreacion
> > > > > > >        {
> > > > > > >            get
> > > > > > >            {
> > > > > > >                return fechaCreacion;
> > > > > > >            }
> > > > > > >            set
> > > > > > >            {
> > > > > > >                fechaCreacion = value;
> > > > > > >            }
> > > > > > >        }
> >
> > > > > > >        public virtual double CostoEstatal
> > > > > > >        {
> > > > > > >            get
> > > > > > >            {
> > > > > > >                return costoEstatal;
> > > > > > >            }
> > > > > > >            set
> > > > > > >            {
> > > > > > >                costoEstatal = value;
> > > > > > >            }
> > > > > > >        }
> >
> > > > > > >        public virtual double CostoFederal
> > > > > > >        {
> > > > > > >            get
> > > > > > >            {
> > > > > > >                return costoFederal;
> > > > > > >            }
> > > > > > >            set
> > > > > > >            {
> > > > > > >                costoFederal = value;
> > > > > > >            }
> > > > > > >        }
> >
> > > > > > >        public virtual double CostoOtros
> > > > > > >        {
> > > > > > >            get
> > > > > > >            {
> > > > > > >                return costoOtros;
> > > > > > >            }
> > > > > > >            set
> > > > > > >            {
> > > > > > >                costoOtros = value;
> > > > > > >            }
> > > > > > >        }
> >
> > > > > > >    }//end Obra
> >
> > > > > > --
> > > > > > Ken Egozi.
> > > > >
> http://www.kenegozi.com/bloghttp://www.delver.comhttp://www.musicglue.
> > > ..
> >
> > --
> > Fabio Maulo
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to