Perhaps is because the entity itself is lazy-false. We have no test for this case. Please file a new JIRA ticket.
On Thu, Apr 7, 2011 at 1:28 PM, Fabio Maulo <[email protected]> wrote: > Please use our JIRA and attach the test case. > Thanks. > > > On Thu, Apr 7, 2011 at 1:24 PM, Ricardo Peres <[email protected]> wrote: > >> Hello again! >> >> Here's the code: >> >> ModelMapper mapper = new ModelMapper(); >> >> mapper.Class<Customer>(ca => >> { >> ca.Table("`CUSTOMER`"); >> ca.Lazy(false); >> ca.Id(x => x.Id, map => >> { >> map.Column("`ID`"); >> map.Generator(new HiLoWithSuffixIdGenerator(), g => >> g.Params(new >> { max_lo = "1000" })); >> }); >> ca.NaturalId(x => x.Property(c => c.Name)); >> ca.Property(x => x.Name, p => >> { >> p.NotNullable(true); >> p.Column("`NAME`"); >> }); >> ca.Property(x => x.Address, p => >> { >> p.NotNullable(false); >> p.Lazy(true); >> p.Column("`ADDRESS`"); >> }); >> ca.Set(c => c.Orders, c => >> { >> c.Key(x => x.Column("`CUSTOMERID`")); >> c.Lazy(CollectionLazy.Lazy); >> c.Inverse(true); >> c.Cascade(Cascade.All); >> }, c => c.OneToMany()); >> }); >> >> public class Customer >> { >> public virtual Int64 Id >> { >> get; >> private set; >> } >> >> public virtual String Name >> { >> get; >> set; >> } >> >> public virtual String Address >> { >> get; >> set; >> } >> >> public virtual IEnumerable<Order> Orders >> { >> get; >> private set; >> } >> } >> >> Class Order is mapped similarly, everything is working fine. Now, if I >> do a: >> >> Customer cust = session.Get<Customer>(1000L); >> >> I get a class cast exception saying that it cannot convert an Object >> into a String in Customer. If I comment out the p.Lazy(true) line on >> the Address property mapping, it works fine. BTW, I also tried it with >> HBM.XML, and I got the same exception. >> >> Thanks, >> >> RP >> >> >> >> >> On Apr 7, 5:16 pm, Fabio Maulo <[email protected]> wrote: >> > I have checked our tests and we have a specific test using >> > string NHibernate.Test.LazyProperty and it work. >> > Which is your problem ? >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > On Thu, Apr 7, 2011 at 1:03 PM, Fabio Maulo <[email protected]> >> wrote: >> > > No one of both >> > >> > > On Thu, Apr 7, 2011 at 11:00 AM, Ricardo Peres <[email protected]> >> wrote: >> > >> > >> Hi, >> > >> > >> It seems that NH 3.2 (trunk version) no longer supports lazy >> > >> properties of String type. At least, I'm having trouble with it: when >> > >> querying, I get an exception complaining about the property type. >> > >> Is this a known problem, or a new decision? >> > >> > >> Thanks! >> > >> > >> RP >> > >> > > -- >> > > Fabio Maulo >> > >> > -- >> > Fabio Maulo >> > > > > -- > Fabio Maulo > > -- Fabio Maulo
