Yes. Before you call Save(), be sure the value of each DateTime property is between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM. You can also change them to a DateTime?, allow nulls on the column, and set it to null.
Unless you absolutely must use this DB design, you should use a better ID generator. Identity will give you nothing but headaches. Thanks, Jason On Thu, Oct 14, 2010 at 1:52 PM, Trygve Lorentzen < [email protected]> wrote: > Thanks a lot, yes, the RacedayID is identity/auto-inc column. I'll > make sure to include error message in future posts! > > System.Data.SqlTypes.SqlTypeException > SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and > 12/31/9999 11:59:59 PM. > > Since this comes from the DB, does this mean that the insert statement > is executed immediately when I call session.Save(raceday)? Can I > prevent that from happening? > > On 14 Okt, 19:53, Fabio Maulo <[email protected]> wrote: > > If > > Id(x => x.RacedayID).Column("RacedayID"); > > mean "native" or "identity" generator, then the exception come from DB. > > btw it would be very easy to understand if instead ask "Does the error > stem > > from nHibernate mapping OR the database?" you send us the message of the > > exception. > > > > On Thu, Oct 14, 2010 at 2:36 PM, Trygve Lorentzen < > > > > > > > > > > > > [email protected]> wrote: > > > public class RacedayMap : ClassMap<Raceday> > > > { > > > public RacedayMap() > > > { > > > Id(x => x.RacedayID).Column("RacedayID"); > > > Map(x => x.RacedayNr); > > > Map(x => x.RDate); > > > Map(x => x.TrackCond); > > > Map(x => x.TrackValue); > > > Map(x => x.Weather); > > > > > References(x => x.Track).Column("TrackID").Cascade.All(); > > > HasMany(x => x.Races) > > > .Cascade.All() > > > .Not.LazyLoad() > > > .Inverse() > > > .AsList() > > > .Access.CamelCaseField(Prefix.Underscore); > > > } > > > } > > > > > It's 1 to 1 mapping with DB, if I set RDate property BEFORE attaching > > > to session it works fine. I could probably make a small test project > > > if that would help... > > > > > On 14 Okt, 17:49, Aaron Fischer <[email protected]> wrote: > > > > can we see your mapping and table schema > > > > > -- > > > 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 > > -- > 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. > > -- 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.
