With an assigned ID, you must call either update or create, save won't do.

-Markus

2009/4/10 Pedro <[email protected]>

>
> Ops, yeah thats it! Thanks!
> But, now the data doesn't persist. Wouldn't newUser.SaveAndFlush() do
> the job?
>
>
> Thanks again!
>
>
>
> On Apr 10, 1:24 pm, "José F. Romaniello" <[email protected]>
> wrote:
> > assigned id?
> >
> > Pedro escribió:
> >
> >
> >
> > > Hi,
> >
> > > I'm trying out NHibernate with ActiveRecord for the first time, but I
> > > can't seem to get past this exception.
> >
> > > This is my User class:
> > > [ActiveRecord("User")]
> > >     public class User : ActiveRecordBase<User>
> > >     {
> > >         [PrimaryKey]
> > >         public int Id { get; set; }
> >
> > >         [Property]
> > >         public string Name { get; set; }
> >
> > >         [Property]
> > >         public string Email { get; set; }
> > >     }
> >
> > > Initialize:
> > > IConfigurationSource config = ActiveRecordSectionHandler.Instance;
> > > ActiveRecordStarter.Initialize(Assembly.Load("TestApplication"),
> > > config);
> >
> > > And create a new user:
> > > User newUser = new User();
> > > newUser.Id = 1;
> > > newUser.Name = this.textBox1.Text;
> > > newUser.Email = this.textBox2.Text;
> > > newUser.Save();
> >
> > > However, I'm getting this exception:
> > > NHibernate.StaleStateException: Unexpected row count: 0, expected: 1.
> >
> > > Any ideas of what could be wrong?
> >
> > > Thanks!
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Development List" 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/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to