These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Many-to-Many read after save problem.
PostPosted: Thu Nov 01, 2007 4:32 am 
Newbie

Joined: Thu Nov 01, 2007 4:11 am
Posts: 1
Any way to delete this topic? It seems that we have ui problem. That was definately DNN caching problem. Moderators please delete topic.
NHibernate version: Don't know included in castle RC3

I use windsor container from Castle. I use "Services" to fetch data from database. These services are accessed using WindsorContainer.Resolve<ServiceName>().<MethodName>() which actually uses either session.CreateQuery or criteria based data search and also Session.Load to fetch data by id.
The problem is that saving data works perfectly (records are altered, deleted or inserted into database and <set> many-to-many records are updated), but when I read data from database data for <set> <bag> or any other collection is returned the same as saved for all records i fetch instead of returning different data for different records.

My mapping files fragments:
Code:
...
   <class name="Group" table="Group" lazy="false">
      <id name="GroupID" column="GroupID" type="Int32" unsaved-value="0">
         <generator class="native"/>
      </id>

...
    <set name="Sections"  inverse="false" cascade="all-delete-orphan"  table="Sections" lazy="false">
      <key column="GroupID"/>
      <many-to-many class="Section" column="SectionID" />
    </set>


  </class>
 
<class name="Section" table="Section" lazy="false">

      <id name="SectionID" column="SectionID" type="Int32" unsaved-value="0">
         <generator class="native"/>
      </id>
      <property column="name" type="String" name="Name" not-null="true" length="150" />

    <set name="Groups" inverse="false" cascade="all-delete-orphan" lazy="false">
      <key column="SectionID"/>
      <many-to-many class="Group" column="GroupID" />
    </set>
</class>
...
</hibernate-mapping>


So I get for Group class same records in Group.Sections set for different Group records.

Any idea what's wrong? I have suspiction that all this happens, because windsor creates singletons of services and caches them, so i have only one opened session. Is it problem? Do i need to close and reopen session again after saving for this to work?
--
Regards,
Dmitry


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.