-->
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.  [ 3 posts ] 
Author Message
 Post subject: lazy fetching
PostPosted: Thu May 12, 2005 6:37 am 
Newbie

Joined: Wed May 11, 2005 5:39 am
Posts: 9
Hello.

A have a problem or rather misunderstanding :(

There is relation one-to-many

Code:
   <class name="Workstation" table="SP_WORKSTATIONS" dynamic-update="true" dynamic-insert="true" lazy="true">
      <meta attribute="scope-set">private</meta>
        <id name="id" type="long" column="WORKSTATIONID" >
         <generator class="sequence">
                <param name="sequence">GEN_SP_WORKSTATIONS_ID</param>
            </generator>
      </id>
...
       <set name="logs"
            lazy="true"
            inverse="true"
            cascade="save-update">
            <key column="WORKSTATIONID"/>
            <one-to-many class="WorkstationLog" />
       </set>



and


Code:
   <class name="WorkstationLog" table="SP_WORKSTATIONLOGS" dynamic-update="true" dynamic-insert="true" lazy="true">
      <composite-id >
            <key-many-to-one name="workstation" class="Workstation" column="WORKSTATIONID" />
            <key-property name="startdatetime" type="timestamp" column="STARTDATETIME" />
      </composite-id>

...



I fetch the object Workstation from DB and collection logs isn't filling with WorkstationLog objects, lazy="true" works.

Then add new object WorkstationLog in Workstation's ogs-collection . And see that hibernate starts fetching all WorkstationLog objects which already exist in DB. I woukd like to just add new WorkstationLog object without fetching already existing objects.

Is this possible?[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 12, 2005 7:34 am 
Newbie

Joined: Wed Jan 05, 2005 6:54 am
Posts: 15
Read Adding an element to a very large collection

Bye,

Pvblivs


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 12, 2005 8:40 am 
Newbie

Joined: Wed May 11, 2005 5:39 am
Posts: 9
Thanks, it works for me.


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

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.