-->
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: Collections again
PostPosted: Tue Jun 14, 2005 1:22 pm 
Newbie

Joined: Wed Jun 08, 2005 3:36 pm
Posts: 4
There were a lot of posts about collections not loading. I did check them and my problem is a bit different. Namely I have two column foreign key

Code:

      <bag name="ToUserLessonWords" lazy="true">
         <key>
            <column name="lesson_id" />
            <column name="user_id" />
         </key>      
         <one-to-many class="hibernate.LessonWord,hibernate"></one-to-many>
      </bag>


Here is destination entity
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
    <class name="hibernate.LessonWord, hibernate" table="user_lesson_word">

      <composite-id>
         <key-property name="LessonId" column="lesson_id" type="System.Int32" />
         <key-property name="UserId" column="user_id" type="System.Int32" />
         <key-property name="Word" column="word" />
      </composite-id>

        <property name="Score" column="score"></property>
        <property name="Attempts" column="attempts"></property>
        <property name="ReverseAttempts" column="reverse_attempts"></property>         
        <property name="ReverseScore" column="reverse_score"></property>

    </class>
</hibernate-mapping>


Generated SQL is OK
Code:
SELECT touserle0_.lesson_id as lesson_id__, touserle0_.user_id as user_id__, touserle0_.word as word__, touserle0_.lesson_id as lesson_id0_, touserle0_.user_id as user_id0_, touserle0_.word as word0_, touserle0_.reverse_attempts as reverse_6_0_, touserle0_.reverse_score as reverse_7_0_, touserle0_.score as score0_, touserle0_.attempts as attempts0_ FROM user_lesson_word touserle0_ WHERE touserle0_.lesson_id = ?p0 AND touserle0_.user_id = ?p1

and if used to select rows manually selects everything it should...

Collection remains empty however.

Here is the log

Code:
2005-06-14 13:08:39,088 [1672] DEBUG NHibernate.Loader.Loader [] <> - result set contains (possibly empty) collection: [hibernate.UserLesson.ToUserLessonWords#hibernate.UserLesson]
2005-06-14 13:08:39,088 [1672] INFO  NHibernate.Impl.SessionImpl [] <> - uninitialized collection: initializing
2005-06-14 13:08:39,098 [1672] DEBUG NHibernate.Loader.Loader [] <> - processing result set
2005-06-14 13:08:39,098 [1672] DEBUG NHibernate.Loader.Loader [] <> - done processing result set (0 rows)
2005-06-14 13:08:39,098 [1672] DEBUG NHibernate.Loader.Loader [] <> - total objects hydrated: 0
2005-06-14 13:08:39,098 [1672] DEBUG NHibernate.Impl.SessionImpl [] <> - 1 collections were found in result set
2005-06-14 13:08:39,108 [1672] DEBUG NHibernate.Impl.SessionImpl [] <> - collection fully initialized: [hibernate.UserLesson.ToUserLessonWords#hibernate.UserLesson]
2005-06-14 13:08:39,118 [1672] DEBUG NHibernate.Impl.SessionImpl [] <> - 1 collections initialized


Any ideas what I am doing wrong?


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.