Yes... it is a very ugly issue.
Probably the cause is that you have not used NH to writing that table or you
have changed the mapping/class.
To find it you can:
var lids = statelessSession.CreateQuery("select c.Id from YourClass
c").List<int>();
foreach(var id in lids)
{
log.Debug("going to read #"+id);
statelessSession.Get<YourClass>(id);
}


2009/11/30 Victor Rosenberg <[email protected]>

> Thanks for the answer, Oskar
> Fail on persist: it doesn't specify the value, or even the property
> name that fails - I've discovered that the uints are the problematic
> ones by systematically commenting parts of the mappings.
> Fail on load - the boxing explanation is worth looking into, but what
> can be done there? Also, the database value isn't null, I've double
> checked..
>
> On Nov 30, 8:19 pm, Oskar Berggren <[email protected]> wrote:
> > fail on persists: what is the value that it claims is outside the
> > expected range?
> >
> > fail on load: one possible explanation for the invalid cast is that
> > oracle's dbprovider may return a boxed uint, i.e. a UInt32 instance.
> > With the mapping with Int32 probably something is trying to cast that
> > boxed uint directly to an int, which is not valid (you would have to
> > unbox it first). Another explanation may be that you have NULL in the
> > database, causing the oracle provider to return DbNull.Value.
> >
> > /Oskar
> >
> > 2009/11/30 Victor Rosenberg <[email protected]>:
> >
> > > Thanks for the answer.
> >
> > > I think it fails of translating from whatever type oracle's ODP
> > > returns to the uint property.
> > > There is a value returned, and its even a small integer one.
> >
> > > On Nov 30, 7:58 pm, Fabio Maulo <[email protected]> wrote:
> > >> for example you have a null and a not nullable property.
> >
> > >> 2009/11/30 Fabio Maulo <[email protected]>
> >
> > >> > If the query is valid what is invalid is a value.
> >
> > >> > 2009/11/30 Victor Rosenberg <[email protected]>
> >
> > >> > When using the uint mappings:
> > >> >> "Value doesn't fall within the expected range" - fails somewhere in
> > >> >> the oracleParameter.st_dbtype while trying to persist
> > >> >> When using the int mappings:
> > >> >> "Couldn't execute query (<valid sql select query here>)
> > >> >> Inner exception - Specified cast not valid" - fails when loading
> the
> > >> >> object from the db
> >
> > >> >> On Nov 30, 11:07 am, Oskar Berggren <[email protected]>
> wrote:
> > >> >> > Specifying the exceptions might be a good idea.
> >
> > >> >> > /Oskar
> >
> > >> >> > 2009/11/30 Victor Rosenberg <[email protected]>:
> >
> > >> >> > > Hey guys
> > >> >> > > I am having some problems with mapping uint properties.
> > >> >> > > I am using oracle, the relevant table column is of INTEGER
> datatype.
> > >> >> > > The mapped class has uint property.
> > >> >> > > When the mapping is like that:
> > >> >> > > <property name="xxx" column="yyy" type="UInt32"/> - there are
> > >> >> > > exceptions trying to persist the class.
> > >> >> > > For <property name="xxx" column="yyy" type="Int32"/> - there
> are
> > >> >> > > exceptions trying to load it.
> > >> >> > > Skipping the type declaration doesnt help either.
> > >> >> > > Any ideas?
> >
> > >> >> > > Thanks in advance
> >
> > >> >> > > --
> >
> > >> >> > > 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]<nhusers%[email protected]>
> <nhusers%[email protected]<nhusers%[email protected]>
> >
> > >> >> .
> > >> >> > > For more options, visit this group athttp://
> > >> >> groups.google.com/group/nhusers?hl=en.
> >
> > >> >> --
> >
> > >> >> 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]<nhusers%[email protected]>
> <nhusers%[email protected]<nhusers%[email protected]>
> >
> > >> >> .
> > >> >> For more options, visit this group at
> > >> >>http://groups.google.com/group/nhusers?hl=en.
> >
> > >> > --
> > >> > Fabio Maulo
> >
> > >> --
> > >> 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]<nhusers%[email protected]>
> .
> > > For more options, visit this group athttp://
> groups.google.com/group/nhusers?hl=en.
>
> --
>
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>
>


-- 
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