Have you flush your session?

On Nov 20, 8:12 pm, mathieu <[email protected]> wrote:
> Hello everyone,
>
> I have a Blog class, that has a <list> of Post in it. I can't manage
> to update only the order, like this :
>
> Post temp = myBlog.Posts[idx];
> myBlog.Posts.Remove(temp);
> myBlog.Posts.Insert(idx + 1, temp);
> mySession.Save( myBlog );
>
> When I do this, no update is issued, and the new order is not
> persisted.
> Am I doing something wrong ? Or shouldn't I use an indexed list for
> this purpose (defining an order). I also tried swapping the two
> elements (without removal), with no success.
>
> Thanks.
>
> PS. The mapping is like this :
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
>     assembly="Blog"
>     namespace="Blog.Entities">
>   <class name="Blog" table="BLOG" >
>     <id name="Id" type="System.Int64" column="ID_BLOG">
>       <generator class="increment"/>
>     </id>
>     <list name="Posts" cascade="all" table="POSTS" inverse="true" >
>       <key column="ID_BLOG" />
>       <index type="System.Int32" column="ORDER" />
>       <one-to-many class="Post"/>
>     </list>
>   </class>
>
>   <class name="Post" table="POST" >
>     <id name="Id" type="System.Int64" column="ID_POST">
>       <generator class="increment"/>
>     </id>
>     <many-to-one name="Blog" column="ID_BLOG" class="Blog" not-
> null="true" />
>   </class>
> </hibernate-mapping>

--

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


Reply via email to