-->
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: Urgent : Hibernate and lazy loading and nested tags
PostPosted: Wed Jan 10, 2007 9:25 pm 
Newbie

Joined: Wed Jan 10, 2007 8:47 pm
Posts: 1
Hi All,
I got this stragnge problem:
I have a membrs table , some of those members which are masters. it means they could have other members attached to them , so for that I have a column for each meber row that designate the type of each member , is it a father(value 1 ) or a child (value 0) and a second column that specifies the father of each mumber.

Basicly the relation betwenn my members is many to one: parent -shild and it's recursive . memebrs which are childs are having the foreign key column father refering to a specific father and the foreign key of the father is refering to himself cause the parent is a praent of himself olso. my members table have also a relation with a custoemers table wich is located on a second schema but in the same databse server: so the relation between my members table and customers table is one to many: ( many memebrs one customer) here is the a snapshot xml mapping of my table:

Code:
<class name="Summary" table="CONSUM">
      <id name="Id" column="CONSUMID">
         <generator class="identity" />
      </id>
      <property name='companyNumber' column='CSCONO' />
      <property name='clientAccountNumber' column='CSCUNO' />
      <property name='memberType' column='CSMEMTYPE' />
      <property name='active' column='CSACTIVE' />
      <property name='master' column='ISMASTER' />



            
   
      <set name='childs'  lazy="true">
<key column="CSFATHER" foreign-key="CONSUMID" not-null="false"   />
<one-to-many class="Summary" />
      </set>


      <many-to-one name="customer" class="Customer" insert="false"
         update="false">
         <column name="CSCONO" />
         <column name="CSCUNO" />
      </many-to-one>
   <many-to-one name="father" class="Summary">
         <column name="CSFATHER" />
         
      </many-to-one>



   </class>


I had a problem with my jsp page but it's strange: the displaying works perfectly for all memebrs expect 4 or 5. and the exception is throwen bu the geter method of my summary Bean(mebers Bean) in the nested properties customer.companyName, here is a snapshot ofthe xml maping of my cutomers table:

Code:
   <class name="Customer" table="OCUSMA">
      <composite-id>
         <key-property name='companyNumber' column='OKCONO' />
         <key-property name='clientAccountNumber' column='OKCUNO' />
      </composite-id>

      <property name='warehouseNumber' column='OKWHLO' />
      <property name='memberType' column='OKCFC3' />
      <property name='connaisseurAccountNumber' column='OKCFC4' />
      <property name='address1' column='OKCUA1' />
      <property name='address2' column='OKCUA2' />
      
   </class>


and here is a snapshot my members and cutomers Beans:

Code:
public class Summary implements Serializable {
private Customer m_customer;//the coressponding customer of this member
    private boolean m_bActive;
    private double m_dLastYearCDP;
    private double m_dUnusedCDP;
    private double m_dCurrentYearCDPAdjustment;
    private double m_dCurrentYearCDPSold;
    private double[] m_monthsCDPAdjustments = new double[12];
    private double[] m_monthsCDPSold = new double[12];
    private Date m_memberSince;
    private Date m_leavedSince;
    private double m_dCurrentYearCDP;
    private boolean m_bMaster;
    // the memebers that belongs to this master memeber: if it is a master
    private Set m_objSetItems;
    //the father
    private Summary m_objFather;
    private Set m_objSetShilds;
    private int m_iShildsNumber;


Code:
public class Customer implements Serializable {

   

    private int m_iCompanyNumber;
    private String m_sClientAccountNumber;
    private String m_sConnaisseurAccountNumber;
    private String m_sMemberType;
    private String m_sPhone1;
    private String m_sPhone2;
   
    private String m_sFirstName;
 
    private String m_sCompanyName;
    private Summary m_summary;// the member corresponding to this customer
......................................
//end class summary



and finaly a snapshot of my jsp page, it bugs when the lazy loding calls the getter of customer.companyName:
Code:
<tr class='tr<%=i.intValue()%2==0?"1":"2"%>'>
            <td><bean:write name="summary" property="id" /></td>
            <td><bean:write name="summary" property="customer.clientAccountNumber" /></td>
            <td align="center">
               <logic:equal name="summary" property="active" value="true">
                  <img src="images/checked.jpg"></img>
               </logic:equal>
               <logic:equal name="summary" property="active" value="false">
                  <img src="images/unchecked.jpg"></img>
               </logic:equal>
            </td>

            <td><font size="-1">
         <bean:write name="summary" property="customer.companyName" />
</font></td>
            <td align="right"><fmt:formatNumber minFractionDigits="2"><bean:write name="summary" property="currentYearCDP" /></fmt:formatNumber></td>
            <td align="right"><fmt:formatNumber minFractionDigits="2"><bean:write name="summary" property="currentMonthCDPAdjustment" /></fmt:formatNumber></td>
            <td align="right"><fmt:formatNumber minFractionDigits="2"><bean:write name="summary" property="lastYearCDP" /></fmt:formatNumber></td>



the jsp page stops in the 5th itreation in the <bean:write name="summary" property="customer.companyName" /> tag and the value of customer.companyName in the databse is normal, it's not empty and there is no special caracters in it.

I,m realy tier donne with this issue espacialy when it works for all the rows excpet 4 or 5 rows
any kind of hepl or imput would be appriciated.

[/code]


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.