-->
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: Problem with lazy loading
PostPosted: Mon May 29, 2006 5:09 pm 
Beginner
Beginner

Joined: Fri May 12, 2006 10:48 am
Posts: 33
I asked before about loading many-to-one relation in a lazy way. I should add to my mapping files “Lazy=true” in the class definition and then declare the class properties as Overridable.
Now I’m having the following problem. I have these classes.

<class name=" Empresa " table="Empresas" lazy="true">
<id name="Id" type="Int32" unsaved-value="0">
<column name="idEmpresa" sql-type="int" not-null="true" unique="true" />
<generator class="native" />
</id>
<property name="Codigo" type="String">
<column name="codEmpresa" length="4" sql-type="char" not-null="true" unique="true" />
</property>
<property name="Descripcion" type="String">
<column name="Descripcion" length="60" sql-type="char" not-null="true"/>
</property>
<many-to-one name="Sector" class="Sector">
<column name="IdSector" sql-type="int" not-null="false"/>
</many-to-one>
</class>

And

<class name="Sector " table="Sectores" lazy="true">
<id name="Id" type="Int32" unsaved-value="0">
<column name="IdSector" sql-type="int" not-null="true" unique="true" />
<generator class="native" />
</id>
<property name="CodSector" type="String">
<column name="codSector" length="3" sql-type="char" not-null="true"/>
</property>
<property name="Descripcion" type="String">
<column name="Descripcion" length="60" sql-type="varchar" not-null="true"/>
</property>
</class>

When I load first a list with Empresas, first a “Select” on Empresas table is done and then, several selects on Sector table are done (one for each Object Empresa that I show in the list), all this works fine but when I load a ComboBox with Sectores and a new Select on Sectores table is done, the new Sector objects (that weren’t loaded in the Empresas List) don’t show their Description in the ComboBox, they show “Sector” (their namespace) instead.
Could anybody help me?


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.