-->
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: Can't get a many-to-one with a property-ref to lazy load
PostPosted: Tue Apr 26, 2005 1:53 am 
Newbie

Joined: Tue Jul 20, 2004 8:52 pm
Posts: 6
I using 3.0.1 on MS Sql Server and have some many-to-one associations in my class that I can't get to lazy load.

Code:
<class
        name="au.edu.nd.teachingprac.domain.PracRecord"
        table="SPTP"
        dynamic-update="false"
        dynamic-insert="false"
        lazy="true"
    >
    <cache usage="read-write" />

    ...

    <many-to-one
            name="studentMark"
            class="au.edu.nd.teachingprac.domain.StudentMarks"
            cascade="none"/
            outer-join="auto"
            update="false"
            insert="false"
            access="property"
            property-ref="pracMark"
        >
            <column name="skey" />
            <column name="Ttperiod" />
            <column name="mkey" />
     </many-to-one>
 
     ...
  </class>



  <class
        name="au.edu.nd.teachingprac.domain.StudentMarks"
        table="STMA"
        dynamic-update="false"
        dynamic-insert="false"
        lazy="true"
    >
        <cache usage="read-only" />
       ...
       <!-- unique key -->
       <component
            name="pracMark"
            class="au.edu.nd.teachingprac.domain.PracMark"
        >
            <property
                name="studentKey"
                type="java.lang.String"
                update="false"
                insert="false"
                access="property"
                column="skey"
            />
            <property
                name="ttperiod"
                type="java.lang.String"
                update="false"
                insert="false"
                access="property"
                column="ttperiod"
            />
            <property
                name="subject"
                type="java.lang.String"
                update="false"
                insert="false"
                access="property"
                column="mkey"
            />
        </component>
       ...
</class>


Any access, eg session.get(PracRecord.class, 786) or queries returning PracRecord's will trigger an additional select to load the StudentMark for each PracRecord. I thought maybe because the component class, PracMark, can't(?maybe im wrong here) be marked as lazy and proxied like a top level class can, it's the cause of the problem.

Any ideas what I'm doing wrong? or if im going about this the wrong way. I had tried doing it using a <properties> element instead of a component, but that approach wasn't right as I would get classcast exceptions in the depths of hibernate.


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.