I think it should be:

SimpleQuery query = new SimpleQuery(typeof(User), "update User usr set
usr.Login= 'Test' ");

Case matters and you have to use the defined property name.

~Gerdus

On Tue, Sep 15, 2009 at 4:16 PM, Gustavo Melo <[email protected]> wrote:
> Thanks Gauthier,
>
> But i'm still have a trouble with that...
>
> I try something like that:
>
> [ActiveRecord("user")]
> public class User : ActiveRecordBase
> {
>        [PrimaryKey(PrimaryKeyType.Assigned, "usu_id")]
>        public string Id { get; set; }
>
>        [Property("name", NotNull = true)]
>        public string Login { get; set; }
>
>         public void updateAllUsers()
>         {
>             SimpleQuery query = new SimpleQuery(typeof(User), "update user
> set name = Test");
>
>             ExecuteQuery(query);
>         }
> }
>
> When i call updateAllUsers: Could not perform ExecuteQuery for Usuario
>
> user is not mapped [update user set name = 'Test']
>
> All CRUD's operations work fine, but i don't know how to use HQL.
>
>
> On Tue, Sep 15, 2009 at 2:38 AM, Gauthier Segay <[email protected]>
> wrote:
>>
>> Best way is executing an update HQL statement:
>>
>>
>> http://ayende.com/Blog/archive/2009/05/28/nhibernate-ndash-executable-dml.aspx
>>
>> using the execute callback is the straight forward way:
>>
>>
>> http://www.castleproject.org/ActiveRecord/documentation/v1rc1/usersguide/hql.html
>>
>> On Sep 14, 9:43 pm, Gustavo Melo <[email protected]> wrote:
>> > I have a table (user)
>> >
>> > [ActiveRecord("user")]
>> > public class User : ActiveRecordBase
>> > {
>> >         [PrimaryKey(PrimaryKeyType.Assigned, "usu_id")]
>> >         public string Id { get; set; }
>> >
>> >         [Property("name", NotNull = true)]
>> >         public string Login { get; set; }
>> >
>> > }
>> >
>> > How do i update all users in the table for name = "Test" ?
>> >
>> > I didn't find on web or documantation...
>> >
>> > Some1 can help me?
>> >
>> > Best Regards
>>
>
>
>
> --
> Analista Desenvolvedor
> www.espacodj.com
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to