-->
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.  [ 12 posts ] 
Author Message
 Post subject: Arrays load the proxy n side
PostPosted: Tue May 04, 2004 10:53 am 
Pro
Pro

Joined: Mon Sep 08, 2003 4:30 pm
Posts: 203
Hi All,

A class declares an array like

Code:
   
<class name="com.db.device.NEPort" table="ne_port" mutable="true" polymorphism="implicit" dynamic-update="false" dynamic-insert="false">

   <array name="statsArray" cascade="all">
         <key>
            <column name="id_port_stats"/>
         </key>
         <index column="ndx_port_stats"/>
         <one-to-many class="com.db.device.InterfaceStats"/>
      </array>
</class>


Although the com.db.device.InterfaceStats is declared with proxy, it is always retrieved when I get the com.db.device.NEPort class.

Code:
select statsarray0_.id as id__, statsarray0_.id_intf_stats as id_intf_5___, statsarray0_.ndx_intf_stats as ndx_intf6___, statsarray0_.id as id0_, statsarray0_.sampleTime as sampleTime0_ from intf_stats statsarray0_ where statsarray0_.id_intf_stats=?

Why?

TIA,

--steve p.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 05, 2004 12:03 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Show om.db.device.InterfaceStats mapping.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 05, 2004 1:34 pm 
Pro
Pro

Joined: Mon Sep 08, 2003 4:30 pm
Posts: 203
Code:
<hibernate-mapping default-cascade="none" auto-import="true">
    <class name="com.db.device.InterfaceStats" table="intf_stats" mutable="true" polymorphism="implicit" dynamic-update="false" dynamic-insert="false" proxy="com.db.device.InterfaceStats">
      <id name="id" type="long" unsaved-value="0">
         <generator class="native">
         </generator>
      </id>
        <property name="sampleTime" type="int"/>

      <array name="statsForVariablesIngress" cascade="all">
         <key>
            <column name="id_stats_ingress"/>
         </key>
         <index column="ndx_stats_ingress"/>
         <one-to-many class="com.db.device.StatsValue"/>
      </array>

      <array name="statsForVariablesEgress" cascade="all">
         <key>
            <column name="id_stats_egress"/>
         </key>
         <index column="ndx_stats_egress"/>
         <one-to-many class="com.db.device.StatsValue"/>
      </array>

    </class>

</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 06, 2004 6:03 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
A load() of NEPort shoyuld not load InterfaceStats unless you access it for real.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 06, 2004 9:41 am 
Pro
Pro

Joined: Mon Sep 08, 2003 4:30 pm
Posts: 203
emmanuel wrote:
A load() of NEPort should not load InterfaceStats unless you access it for real.


Thanks, Emmanuel. That's what I thought it should work.
But it doesn't.

The java code for getting the port object is:

Code:
beginTransaction();
      
NEPort port = (NEPort)session.load(NEPort.class, new Long(10));      
endTransaction(false);


Should I submit a bug to JIRA?

TIA,

--steve p.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 06, 2004 9:50 pm 
Pro
Pro

Joined: Mon Sep 08, 2003 4:30 pm
Posts: 203
Emmanuel (or anybody else),

Could you please confirm if this is a bug or not?

TIA.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 18, 2004 2:26 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Actually, I'm not sure this is doable for Arrays.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 18, 2004 5:05 pm 
Pro
Pro

Joined: Mon Sep 08, 2003 4:30 pm
Posts: 203
emmanuel wrote:
Actually, I'm not sure this is doable for Arrays.


Does anybody from Hibernate team know for sure? Maybe Gavin?

TIA,

--steve p.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 18, 2004 5:21 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Arrays can't be lazily initialized (they can't be wrapped by Hibernate), only collections (and Maps).

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 18, 2004 5:27 pm 
Pro
Pro

Joined: Mon Sep 08, 2003 4:30 pm
Posts: 203
christian wrote:
Arrays can't be lazily initialized (they can't be wrapped by Hibernate), only collections (and Maps).


Christian,

I am interested if the (proxy) objects contained in an array could be lazily loaded, not the array per se.

I know the array cannot be lazy loaded, but I expect that the members declared as proxy objects
Quote:
not
to be loaded automatically when I first load the array. Is this how it is supposed to work?

Could you please specify?

Thank you so much.

--steve p.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 18, 2004 5:28 pm 
Pro
Pro

Joined: Mon Sep 08, 2003 4:30 pm
Posts: 203
christian wrote:
Arrays can't be lazily initialized (they can't be wrapped by Hibernate), only collections (and Maps).


Christian,

I am interested if the (proxy) objects contained in an array could be lazily loaded, not the array per se.

I know the array cannot be lazy loaded, but I expect that the members declared as proxy objects not to be loaded automatically when I first load the array. Is this how it is supposed to work?

Could you please specify?

Thank you so much.

--steve p.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 18, 2004 5:29 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
No, how should that work?

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 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.