-->
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: unwanted many-to-one relation fetch
PostPosted: Mon Sep 22, 2003 12:34 pm 
Newbie

Joined: Thu Sep 18, 2003 3:34 am
Posts: 9
I have a model where AttributeValue is related to Attribute using many-to-one one-direction relation. When I load AttributeValue instance hibernate fetches also related Attribute entity (I see it from sql logging). How can I disable it? I load it by:
session.load(AttributeValue.class, new Integer(1));

Here are my class mappings:

<class
name="pl.ken.shop.model.AttributeValue"
dynamic-update="false"
dynamic-insert="false"
>

<id
name="id"
column="ID_AttributeValue"
type="java.lang.Integer"
length="8"
>
<generator class="increment">
</generator>
</id>

<property
name="value"
type="java.lang.String"
update="true"
insert="true"
column="value"
/>

<many-to-one
name="attribute"
class="pl.ken.shop.model.Attribute"
outer-join="false"
column="ID_Attribute"
not-null="false"
/>

</class>

<class
name="pl.ken.shop.model.Attribute"
dynamic-update="false"
dynamic-insert="false"
>

<id
name="id"
column="ID_Attribute"
type="java.lang.Integer"
length="8"
>
<generator class="increment">
</generator>
</id>

<property
name="description"
type="java.lang.String"
update="true"
insert="true"
column="description"
/>

<property
name="name"
type="java.lang.String"
update="true"
insert="true"
column="name"
/>

<property
name="position"
type="int"
update="true"
insert="true"
column="position"
/>

</class>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 22, 2003 5:27 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Enable proxying of the Attribute class in its mapping:
[code]
<class
name="pl.ken.shop.model.Attribute"
table="..."
proxy="pl.ken.shop.model.Attribute"
dynamic-update="false"
dynamic-insert="false"
>
...
[/code


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 23, 2003 3:02 am 
Newbie

Joined: Thu Sep 18, 2003 3:34 am
Posts: 9
proxy is really the only option available? it has some limitations.


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.