-->
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.  [ 10 posts ] 
Author Message
 Post subject: problems w/ bidirectional relationship
PostPosted: Wed Feb 04, 2004 2:05 am 
Newbie

Joined: Wed Feb 04, 2004 1:25 am
Posts: 8
Hello all,
I am having problems with parent-child relationships. I have a parent class that has a one-to-many rela with the child class. the child class has a many-to-one with the parent. I can see the parent when I load the particular child but cannot see the children when I load the parent. The logs acutally show that <b>'n' number of collections were found and initialized</b> but when I iterate over them, I find 0 items in the set. here is the appropriate code. Also I am using composite-ids and hence overrode the hashCode() and equals methods of the classes.
Database used: DB2 on iSeries. One parent record and 2 child records in database. Again I can see the parent from the child. but not the children from the parent. Also I have no problem w/ the fields of the parents.

any help/pointers is greatly appreciated.

test code:
Code:
   public void testLoadChangeRequest() {
      try {
         ChangeRequestVO ch = new ChangeRequestVO();
         ch.setTransactionId("1");
         ch.setTransactionSequenceNum(0);
         
         // 1) open session
         // 2) call load(Object, Serializable)
         // 3) close session.
         HibernateUtil.getInstance().load(ch, ch);
         
         
         assertTrue("program code was wrong", ch.getProgramId().trim().equals("pgm5577"));
         
         // the following assert fails.
         assertTrue("locations request size was incorrect", ch.getLocationRequests().size() == 2);
      }
      catch (Exception ex) {         
         ex.printStackTrace();
         log.warn("Exception thrown", ex);
         fail("test failed with exception");      
      }
   }




Parent (ChangeRequestVO):
Code:
public class ChangeRequestVO extends AbstractBaseVO {
   
   /**
    * This is a private logger used by the class.
    */
   private static final Logger log =
      Logger.getLogger(ChangeRequestVO.class);

   /**
    * This is the flag used to determine if debug logs need to be logged.
    */
   private static final boolean DEBUG = log.isDebugEnabled();

   private String transactionId = null;
   private int transactionSequenceNum;
   private String code = null;
   private String reasonRejected = null;
   private String comments = null;
   private String programId = null;
   private String dateCompleted = null;
   private String estCompletionDate = null;
   private Set locationRequests = new HashSet();

   /**
    * Constructor for ChageRequestVO.
    */
   public ChangeRequestVO() {
      super();
   }
   
   /****** removed simple getter/setters *****/


   /**
    * @see java.lang.Object#equals(Object)
    */
   public boolean equals(Object obj) {
      if (obj instanceof ChangeRequestVO) {
         ChangeRequestVO vo = (ChangeRequestVO) obj;
         return getTransactionId() != null && getTransactionId().equals(vo.getTransactionId()) &&
            (getTransactionSequenceNum() == vo.getTransactionSequenceNum());
      }
      return false;
   }
   
   /**
    * @see java.lang.Object#hashCode()
    */
   public int hashCode() {
      return (transactionId == null ? ((int)(Math.random() * 1e5)) : transactionId.hashCode()) + transactionSequenceNum;
   }

   /**
    * Returns the locationRequests.
    * @return Set
    */
   public Set getLocationRequests() {
      return locationRequests;
   }

   /**
    * Sets the locationRequests.
    * @param locationRequests The locationRequests to set
    */
   public void setLocationRequests(Set locationRequests) {
      if (DEBUG) {
         log.debug("[Setting the locations" + (locationRequests == null ? "null" : locationRequests.toString()) + "]");
      }
      this.locationRequests = locationRequests;
   }
     }

Child (LocationChgReqVO):
Code:
public class LocationChgReqVO extends AbstractBaseVO {

   /* attributes */
   private String name = null;
   private String address1 = null;
   private String address2 = null;
   private String city = null;
   private String state = null;
   private String zip = null;
   private String country = null;
   private String fein = null;
   private String clientId = null;
   private String sortName = null;
   private String phone = null;
   private String dbaName = null;
   private char typeOfChange;
   private ChangeRequestVO parent = null;
   
   /* Keys attributes */
   private String locationNum = null;
   private String transactionId = null;
   private int transactionSequenceNum = 0;
   
   /**
    * Constructor for LocationChgReqVO.
    */
   public LocationChgReqVO() {
      super();
   }
   

   /******* Removed simple getter/setters  ****************/


   /**
    * Returns the parent.
    * @return ChangeRequestVO
    */
   public ChangeRequestVO getParent() {
      return parent;
   }

   /**
    * Sets the parent.
    * @param parent The parent to set
    */
   public void setParent(ChangeRequestVO parent) {
      this.parent = parent;
   }

   /**
    * Implemented these for hibernate composite-id mapping.
    * @see java.lang.Object#equals(Object)
    */
   public boolean equals(Object obj) {
      if (obj instanceof LocationChgReqVO) {
         LocationChgReqVO locvo = (LocationChgReqVO) obj;
         return this.transactionId != null && this.transactionId.equals(locvo.transactionId) &&
               this.transactionSequenceNum == locvo.transactionSequenceNum &&
               this.locationNum != null && this.locationNum.equals(locvo.locationNum);   
      }
      return false;
      
   }

   /**
    * @see java.lang.Object#hashCode()
    */
   public int hashCode() {
      return (this.transactionId == null ? ((int) (Math.random() * 10000)) : this.transactionId.hashCode()) +
               this.transactionSequenceNum +
               (this.locationNum == null ? ((int) (Math.random() * 10000)) : this.locationNum.hashCode());
   }

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
   "hibernate-mapping-2.0.dtd">
<hibernate-mapping
   schema="test"
   package="com.cmp.onlinesystems.endorsements.vos">

  <class name="ChangeRequestVO" table="change_request">
      <composite-id>
         <key-property name="transactionId" column="transaction_id" type="string"/>
         <key-property name="transactionSequenceNum" column="transaction_sequence" type="int"/>
      </composite-id>
      <timestamp name="lastChgDate" column="change_request_last_chg_date"/>
      
      <set name="locationRequests" lazy="false" inverse="true">
         <key>
            <column name="transaction_id"/>
            <column name="transaction_sequence"/>
         </key>
         <one-to-many class="com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO"/>
      </set>   
      
      
      <property name="reasonRejected" column="reason_rejected" type="string"/>
      <property name="programId" column="program_id" type="string"/>
      <property name="estCompletionDate" column="estimated_completion_date" type="string"/>
      <property name="dateCompleted" column="date_completed" type="date"/>
      
      <!-- audit fields -->
      <property name="createDate" column="change_request_create_date" type="timestamp"/>
      <property name="createUserId" column="change_request_create_userid" type="string"/>
      <property name="lastChgUserId" column="change_request_last_chg_userid" type="string"/>
   </class>

   <class name="LocationChgReqVO" table="chg_req_location">
      <composite-id>
         <key-property name="transactionId" column="transaction_id" type="string"/>
         <key-property name="transactionSequenceNum" column="transaction_sequence" type="int"/>      
         <key-property name="locationNum" column="location_number" type="string"/>
      </composite-id>
      <timestamp name="lastChgDate" column="chg_location_last_chg_date"/>
      <many-to-one name="parent" class="com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO"
            cascade="save-update" update="false" insert="false">
            <column name="transaction_id" />
            <column name="transaction_sequence"/>
      </many-to-one>
      <property name="name" column="location_name" type="string"/>
      <property name="address1" column="location_address1" type="string"/>
      <property name="address2" column="location_address2" type="string"/>
      <property name="city" column="location_city" type="string"/>
      <property name="state" column="location_state" type="string"/>
      <property name="zip" column="location_zip" type="string"/>
      <property name="country" column="location_country" type="string"/>
      <property name="clientId" column="client_id" type="string"/>
      <property name="sortName" column="sort_name" type="string"/>
      <property name="phone" column="location_phone_number" type="string"/>
      <property name="fein" column="federal_employer_id_number" type="string"/>
      <property name="dbaName" column="dba_name" type="string"/>
      <property name="typeOfChange" column="type_of_change" type="char"/>
   </class>
   
   
</hibernate-mapping>

Here are the logs (bolded locations where rows are being read). Underlined and bolded the log statement in the setter of Set property where empty set is affixed to my object.


2004-02-03 23:15:28,370 DEBUG impl.SessionImpl - loading [com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO#com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@31]
2004-02-03 23:15:28,370 DEBUG impl.SessionImpl - attempting to resolve [com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO#com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@31]
2004-02-03 23:15:28,370 DEBUG impl.SessionImpl - object not resolved in any cache [com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO#com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@31]
2004-02-03 23:15:28,370 DEBUG persister.EntityPersister - Materializing entity: [com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO#com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@31]
2004-02-03 23:15:28,380 DEBUG impl.BatcherImpl - about to open: 0 open PreparedStatements, 0 open ResultSets
2004-02-03 23:15:28,380 DEBUG connection.DriverManagerConnectionProvider - total checked-out connections: 0
2004-02-03 23:15:28,380 DEBUG connection.DriverManagerConnectionProvider - using pooled JDBC connection, pool size: 0
2004-02-03 23:15:28,380 DEBUG hibernate.SQL - select changerequ0_.transaction_id as transact1_0_, changerequ0_.transaction_sequence as transact2_0_, changerequ0_.change_request_last_chg_date as change_r3_0_, changerequ0_.reason_rejected as reason_r4_0_, changerequ0_.program_id as program_id0_, changerequ0_.estimated_completion_date as estimate6_0_, changerequ0_.date_completed as date_com7_0_, changerequ0_.change_request_create_date as change_r8_0_, changerequ0_.change_request_create_userid as change_r9_0_, changerequ0_.change_request_last_chg_userid as change_10_0_ from fnduwdgen.change_request changerequ0_ where changerequ0_.transaction_id=? and changerequ0_.transaction_sequence=?
2004-02-03 23:15:28,380 DEBUG impl.BatcherImpl - preparing statement
2004-02-03 23:15:28,660 DEBUG vos.ChangeRequestVO - [Calling getter. returning value '1']
2004-02-03 23:15:28,660 DEBUG type.StringType - binding '1' to parameter: 1
2004-02-03 23:15:28,660 DEBUG type.IntegerType - binding '0' to parameter: 2
2004-02-03 23:15:28,831 DEBUG loader.Loader - processing result set
2004-02-03 23:15:28,831 DEBUG loader.Loader - result row: com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@31
2004-02-03 23:15:28,831 DEBUG loader.Loader - Initializing object from ResultSet: com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@31
2004-02-03 23:15:28,831 DEBUG loader.Loader - Hydrating entity: com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO#com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@31
2004-02-03 23:15:28,861 DEBUG type.TimestampType - returning '03 February 2004 22:32:48' as column: change_r3_0_
2004-02-03 23:15:28,861 DEBUG type.StringType - returning null as column: reason_r4_0_
2004-02-03 23:15:28,861 DEBUG type.StringType - returning 'pgm5577 ' as column: program_id0_
2004-02-03 23:15:28,871 DEBUG type.StringType - returning '01-01-04 ' as column: estimate6_0_
2004-02-03 23:15:28,871 DEBUG type.DateType - returning null as column: date_com7_0_
2004-02-03 23:15:28,871 DEBUG type.TimestampType - returning '01 January 2004 00:00:00' as column: change_r8_0_
2004-02-03 23:15:28,871 DEBUG type.StringType - returning 'pkode_test ' as column: change_r9_0_
2004-02-03 23:15:28,871 DEBUG type.StringType - returning 'pkode_test ' as column: change_10_0_
2004-02-03 23:15:28,871 DEBUG impl.SessionImpl - Version: 2004-02-03 22:32:48.128
2004-02-03 23:15:28,871 DEBUG loader.Loader - done processing result set (1 rows)
2004-02-03 23:15:28,871 DEBUG impl.BatcherImpl - done closing: 0 open PreparedStatements, 0 open ResultSets
2004-02-03 23:15:28,881 DEBUG impl.BatcherImpl - closing statement
2004-02-03 23:15:28,961 DEBUG loader.Loader - total objects hydrated: 1
2004-02-03 23:15:28,961 DEBUG impl.SessionImpl - resolving associations for [com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO#com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@31]
2004-02-03 23:15:28,961 DEBUG impl.SessionImpl - collection not cached
2004-02-03 23:15:28,971 DEBUG impl.SessionImpl - initializing collection [com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO.locationRequests#com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@31]
2004-02-03 23:15:28,971 DEBUG impl.BatcherImpl - about to open: 0 open PreparedStatements, 0 open ResultSets
2004-02-03 23:15:28,971 DEBUG hibernate.SQL - select locationre0_.transaction_id as transact1___, locationre0_.transaction_sequence as transact2___, locationre0_.location_number as location3___, locationre0_.transaction_id as transact1_0_, locationre0_.transaction_sequence as transact2_0_, locationre0_.location_number as location3_0_, locationre0_.chg_location_last_chg_date as chg_loca4_0_, locationre0_.transaction_id as transact1_0_, locationre0_.transaction_sequence as transact2_0_, locationre0_.location_name as location5_0_, locationre0_.location_address1 as location6_0_, locationre0_.location_address2 as location7_0_, locationre0_.location_city as location8_0_, locationre0_.location_state as location9_0_, locationre0_.location_zip as locatio10_0_, locationre0_.location_country as locatio11_0_, locationre0_.client_id as client_id0_, locationre0_.sort_name as sort_name0_, locationre0_.location_phone_number as locatio14_0_, locationre0_.federal_employer_id_number as federal15_0_, locationre0_.dba_name as dba_name0_, locationre0_.type_of_change as type_of17_0_ from fnduwdgen.chg_req_location locationre0_ where locationre0_.transaction_id=? and locationre0_.transaction_sequence=?
2004-02-03 23:15:28,971 DEBUG impl.BatcherImpl - preparing statement
2004-02-03 23:15:29,121 DEBUG vos.ChangeRequestVO - [Calling getter. returning value '1']
2004-02-03 23:15:29,121 DEBUG type.StringType - binding '1' to parameter: 1
2004-02-03 23:15:29,121 DEBUG type.IntegerType - binding '0' to parameter: 2
2004-02-03 23:15:29,251 DEBUG loader.Loader - result set contains (possibly empty) collection: [com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO.locationRequests#com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@31]
2004-02-03 23:15:29,251 DEBUG vos.ChangeRequestVO - [Calling getter. returning value '1']
2004-02-03 23:15:29,251 DEBUG vos.ChangeRequestVO - [Calling getter. returning value '1']
2004-02-03 23:15:29,251 DEBUG vos.ChangeRequestVO - [Calling getter. returning value '1']
2004-02-03 23:15:29,251 DEBUG impl.SessionImpl - uninitialized collection: initializing
2004-02-03 23:15:29,251 DEBUG loader.Loader - processing result set
2004-02-03 23:15:29,251 DEBUG type.StringType - returning '1 ' as column: transact1_0_
2004-02-03 23:15:29,251 DEBUG type.IntegerType - returning '0' as column: transact2_0_
2004-02-03 23:15:29,251 DEBUG type.StringType - returning '123 ' as column: location3_0_
2004-02-03 23:15:29,251 DEBUG loader.Loader - result row: com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO@96248e41
2004-02-03 23:15:29,251 DEBUG loader.Loader - Initializing object from ResultSet: com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO@96248e41
2004-02-03 23:15:29,251 DEBUG loader.Loader - Hydrating entity: com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO#com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO@96248e41
2004-02-03 23:15:29,251 DEBUG type.TimestampType - returning '03 February 2004 17:35:00' as column: chg_loca4_0_
2004-02-03 23:15:29,251 DEBUG type.StringType - returning '1 ' as column: transact1_0_
2004-02-03 23:15:29,251 DEBUG type.IntegerType - returning '0' as column: transact2_0_
2004-02-03 23:15:29,251 DEBUG vos.ChangeRequestVO - [Calling setter. setting value '1 ']
2004-02-03 23:15:29,251 DEBUG type.StringType - returning 'tmi ' as column: location5_0_
2004-02-03 23:15:29,251 DEBUG type.StringType - returning '3679random address ' as column: location6_0_
2004-02-03 23:15:29,251 DEBUG type.StringType - returning null as column: location7_0_
2004-02-03 23:15:29,251 DEBUG type.StringType - returning 'austin ' as column: location8_0_
2004-02-03 23:15:29,251 DEBUG type.StringType - returning 'tx' as column: location9_0_
2004-02-03 23:15:29,251 DEBUG type.StringType - returning '78704 ' as column: locatio10_0_
2004-02-03 23:15:29,251 DEBUG type.StringType - returning 'US ' as column: locatio11_0_
2004-02-03 23:15:29,261 DEBUG type.StringType - returning null as column: client_id0_
2004-02-03 23:15:29,261 DEBUG type.StringType - returning null as column: sort_name0_
2004-02-03 23:15:29,261 DEBUG type.StringType - returning null as column: locatio14_0_
2004-02-03 23:15:29,261 DEBUG type.StringType - returning '111111111' as column: federal15_0_
2004-02-03 23:15:29,261 DEBUG type.StringType - returning null as column: dba_name0_
2004-02-03 23:15:29,261 DEBUG type.CharacterType - returning 'L' as column: type_of17_0_
2004-02-03 23:15:29,261 DEBUG impl.SessionImpl - Version: 2004-02-03 17:35:00.562
2004-02-03 23:15:29,261 DEBUG type.StringType - returning '1 ' as column: transact1___
2004-02-03 23:15:29,261 DEBUG type.IntegerType - returning '0' as column: transact2___
2004-02-03 23:15:29,261 DEBUG vos.ChangeRequestVO - [Calling setter. setting value '1 ']
2004-02-03 23:15:29,261 DEBUG loader.Loader - found row of collection: [com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO.locationRequests#com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@935a908f]
2004-02-03 23:15:29,261 DEBUG impl.SessionImpl - new collection: instantiating
2004-02-03 23:15:29,261 DEBUG type.StringType - returning '1 ' as column: transact1___
2004-02-03 23:15:29,261 DEBUG type.IntegerType - returning '0' as column: transact2___
2004-02-03 23:15:29,261 DEBUG type.StringType - returning '123 ' as column: location3___
2004-02-03 23:15:29,261 DEBUG impl.SessionImpl - loading [com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO#com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO@96248e41]
2004-02-03 23:15:29,261 DEBUG impl.SessionImpl - attempting to resolve [com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO#com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO@96248e41]
2004-02-03 23:15:29,261 DEBUG impl.SessionImpl - resolved object in session cache [com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO#com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO@96248e41]
2004-02-03 23:15:29,261 DEBUG type.StringType - returning '1 ' as column: transact1_0_
2004-02-03 23:15:29,261 DEBUG type.IntegerType - returning '0' as column: transact2_0_
2004-02-03 23:15:29,261 DEBUG type.StringType - returning '321 ' as column: location3_0_
2004-02-03 23:15:29,261 DEBUG loader.Loader - result row: com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO@9640b5c1
2004-02-03 23:15:29,261 DEBUG loader.Loader - Initializing object from ResultSet: com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO@9640b5c1
2004-02-03 23:15:29,261 DEBUG loader.Loader - Hydrating entity: com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO#com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO@9640b5c1
2004-02-03 23:15:29,261 DEBUG type.TimestampType - returning '01 January 2004 00:00:00' as column: chg_loca4_0_
2004-02-03 23:15:29,261 DEBUG type.StringType - returning '1 ' as column: transact1_0_
2004-02-03 23:15:29,261 DEBUG type.IntegerType - returning '0' as column: transact2_0_
2004-02-03 23:15:29,261 DEBUG vos.ChangeRequestVO - [Calling setter. setting value '1 ']
2004-02-03 23:15:29,261 DEBUG type.StringType - returning 'work ' as column: location5_0_
2004-02-03 23:15:29,261 DEBUG type.StringType - returning '485 somewhere ' as column: location6_0_
2004-02-03 23:15:29,261 DEBUG type.StringType - returning null as column: location7_0_
2004-02-03 23:15:29,261 DEBUG type.StringType - returning 'austin ' as column: location8_0_
2004-02-03 23:15:29,261 DEBUG type.StringType - returning 'tx' as column: location9_0_
2004-02-03 23:15:29,261 DEBUG type.StringType - returning '78739 ' as column: locatio10_0_
2004-02-03 23:15:29,271 DEBUG type.StringType - returning 'US ' as column: locatio11_0_
2004-02-03 23:15:29,271 DEBUG type.StringType - returning null as column: client_id0_
2004-02-03 23:15:29,271 DEBUG type.StringType - returning null as column: sort_name0_
2004-02-03 23:15:29,271 DEBUG type.StringType - returning null as column: locatio14_0_
2004-02-03 23:15:29,271 DEBUG type.StringType - returning '111111111' as column: federal15_0_
2004-02-03 23:15:29,271 DEBUG type.StringType - returning null as column: dba_name0_
2004-02-03 23:15:29,271 DEBUG type.CharacterType - returning 'T' as column: type_of17_0_
2004-02-03 23:15:29,271 DEBUG impl.SessionImpl - Version: 2004-01-01 00:00:00.0
2004-02-03 23:15:29,271 DEBUG type.StringType - returning '1 ' as column: transact1___
2004-02-03 23:15:29,271 DEBUG type.IntegerType - returning '0' as column: transact2___
2004-02-03 23:15:29,271 DEBUG loader.Loader - found row of collection: [com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO.locationRequests#com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@935a908f]
2004-02-03 23:15:29,271 DEBUG impl.SessionImpl - reading row
2004-02-03 23:15:29,271 DEBUG type.StringType - returning '1 ' as column: transact1___
2004-02-03 23:15:29,271 DEBUG type.IntegerType - returning '0' as column: transact2___
2004-02-03 23:15:29,281 DEBUG type.StringType - returning '321 ' as column: location3___
2004-02-03 23:15:29,281 DEBUG impl.SessionImpl - loading [com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO#com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO@9640b5c1]
2004-02-03 23:15:29,281 DEBUG impl.SessionImpl - attempting to resolve [com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO#com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO@9640b5c1]
2004-02-03 23:15:29,281 DEBUG impl.SessionImpl - resolved object in session cache [com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO#com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO@9640b5c1]
2004-02-03 23:15:29,281 DEBUG loader.Loader - done processing result set (2 rows)
2004-02-03 23:15:29,281 DEBUG impl.BatcherImpl - done closing: 0 open PreparedStatements, 0 open ResultSets
2004-02-03 23:15:29,281 DEBUG impl.BatcherImpl - closing statement
2004-02-03 23:15:29,401 DEBUG loader.Loader - total objects hydrated: 2
2004-02-03 23:15:29,401 DEBUG impl.SessionImpl - resolving associations for [com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO#com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO@96248e41]
2004-02-03 23:15:29,401 DEBUG impl.SessionImpl - loading [com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO#com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@935a908f]
2004-02-03 23:15:29,401 DEBUG impl.SessionImpl - attempting to resolve [com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO#com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@935a908f]
2004-02-03 23:15:29,401 DEBUG impl.SessionImpl - object not resolved in any cache [com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO#com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@935a908f]
2004-02-03 23:15:29,401 DEBUG persister.EntityPersister - Materializing entity: [com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO#com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@935a908f]
2004-02-03 23:15:29,401 DEBUG impl.BatcherImpl - about to open: 0 open PreparedStatements, 0 open ResultSets
2004-02-03 23:15:29,401 DEBUG hibernate.SQL - select changerequ0_.transaction_id as transact1_0_, changerequ0_.transaction_sequence as transact2_0_, changerequ0_.change_request_last_chg_date as change_r3_0_, changerequ0_.reason_rejected as reason_r4_0_, changerequ0_.program_id as program_id0_, changerequ0_.estimated_completion_date as estimate6_0_, changerequ0_.date_completed as date_com7_0_, changerequ0_.change_request_create_date as change_r8_0_, changerequ0_.change_request_create_userid as change_r9_0_, changerequ0_.change_request_last_chg_userid as change_10_0_ from fnduwdgen.change_request changerequ0_ where changerequ0_.transaction_id=? and changerequ0_.transaction_sequence=?
2004-02-03 23:15:29,401 DEBUG impl.BatcherImpl - preparing statement
2004-02-03 23:15:29,532 DEBUG type.StringType - binding '1 ' to parameter: 1
2004-02-03 23:15:29,532 DEBUG type.IntegerType - binding '0' to parameter: 2
2004-02-03 23:15:29,632 DEBUG loader.Loader - processing result set
2004-02-03 23:15:29,632 DEBUG loader.Loader - result row: com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@935a908f
2004-02-03 23:15:29,632 DEBUG loader.Loader - Initializing object from ResultSet: com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@935a908f
2004-02-03 23:15:29,632 DEBUG loader.Loader - Hydrating entity: com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO#com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@935a908f
2004-02-03 23:15:29,632 DEBUG type.TimestampType - returning '03 February 2004 22:32:48' as column: change_r3_0_
2004-02-03 23:15:29,632 DEBUG type.StringType - returning null as column: reason_r4_0_
2004-02-03 23:15:29,632 DEBUG type.StringType - returning 'pgm5577 ' as column: program_id0_
2004-02-03 23:15:29,632 DEBUG type.StringType - returning '01-01-04 ' as column: estimate6_0_
2004-02-03 23:15:29,632 DEBUG type.DateType - returning null as column: date_com7_0_
2004-02-03 23:15:29,632 DEBUG type.TimestampType - returning '01 January 2004 00:00:00' as column: change_r8_0_
2004-02-03 23:15:29,632 DEBUG type.StringType - returning 'pkode_test ' as column: change_r9_0_
2004-02-03 23:15:29,632 DEBUG type.StringType - returning 'pkode_test ' as column: change_10_0_
2004-02-03 23:15:29,632 DEBUG impl.SessionImpl - Version: 2004-02-03 22:32:48.128
2004-02-03 23:15:29,632 DEBUG loader.Loader - done processing result set (1 rows)
2004-02-03 23:15:29,632 DEBUG impl.BatcherImpl - done closing: 0 open PreparedStatements, 0 open ResultSets
2004-02-03 23:15:29,632 DEBUG impl.BatcherImpl - closing statement
2004-02-03 23:15:29,712 DEBUG loader.Loader - total objects hydrated: 1
2004-02-03 23:15:29,712 DEBUG impl.SessionImpl - resolving associations for [com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO#com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@935a908f]
2004-02-03 23:15:29,712 DEBUG vos.ChangeRequestVO - [Setting the locations[]]
2004-02-03 23:15:29,712 DEBUG impl.SessionImpl - done materializing entity [com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO#com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@935a908f]
2004-02-03 23:15:29,712 DEBUG impl.SessionImpl - done materializing entity [com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO#com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO@96248e41]
2004-02-03 23:15:29,712 DEBUG impl.SessionImpl - resolving associations for [com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO#com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO@9640b5c1]
2004-02-03 23:15:29,712 DEBUG impl.SessionImpl - loading [com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO#com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@935a908f]
2004-02-03 23:15:29,712 DEBUG impl.SessionImpl - attempting to resolve [com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO#com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@935a908f]
2004-02-03 23:15:29,712 DEBUG impl.SessionImpl - resolved object in session cache [com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO#com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@935a908f]
2004-02-03 23:15:29,712 DEBUG impl.SessionImpl - done materializing entity [com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO#com.cmp.onlinesystems.endorsements.vos.LocationChgReqVO@9640b5c1]
2004-02-03 23:15:29,712 DEBUG impl.SessionImpl - 2 collections were found in result set
2004-02-03 23:15:29,712 DEBUG impl.SessionImpl - collection fully initialized: [com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO.locationRequests#com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@935a908f]
2004-02-03 23:15:29,712 DEBUG impl.SessionImpl - collection fully initialized: [com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO.locationRequests#com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@31]
2004-02-03 23:15:29,722 DEBUG impl.SessionImpl - 2 collections initialized
2004-02-03 23:15:29,722 DEBUG vos.ChangeRequestVO - [Setting the locations[]]

2004-02-03 23:15:29,722 DEBUG impl.SessionImpl - done materializing entity [com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO#com.cmp.onlinesystems.endorsements.vos.ChangeRequestVO@31]
2004-02-03 23:15:29,722 DEBUG impl.SessionImpl - initializing non-lazy collections
2004-02-03 23:15:29,722 DEBUG impl.SessionImpl - closing session
2004-02-03 23:15:29,722 DEBUG impl.SessionImpl - disconnecting session
2004-02-03 23:15:29,722 DEBUG connection.DriverManagerConnectionProvider - returning connection to pool, pool size: 1
2004-02-03 23:15:29,722 DEBUG impl.SessionImpl - transaction completion

pratap.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2004 8:51 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
1. your hashcode implem probably sucks, hashcode should return the same value for each instance. Match.random() break that

2. use key-many-to-one

3. try not to set new HashSet() in the POJO.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2004 8:57 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
I think 3) is a good idea.

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


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2004 1:30 pm 
Newbie

Joined: Wed Feb 04, 2004 1:25 am
Posts: 8
thanks for your suggestions guys. I tried them out. here's what I found

I tried all 3 suggestions
1) reworked the hashcode implementation. I create a random int for every instance in the super class and return this every time for the object. basically each object gets its moderately unique id (this is just temp. i will provide a better impl later)

2) key-many-to-one

3) removed hashset and tried using tree set.

what ensued was that my load call went into an infinite loop.

so i went back and removed all relationships
1) started with many-to-one for child(the children have a refernece to the parent) and tested this. This worked.
2) removed this relationship. back to no relationships
3) added parent to child link (one-to-many). this time I coded the relationship with list. the hashCode doesnt play in this one.


Testing Step 3 resulted in the same junit test failure.

pratap.

Junit code:
Code:
   public void testLoadChangeRequest() {
      try {
         ChangeRequestVO locVO = new ChangeRequestVO();
         locVO.setTransactionId("1");
         locVO.setTransactionSequenceNum(0);
         hb.load(locVO, locVO);
         log.debug("Program id is '" + locVO.getProgramId() + "'");
         assertTrue("data is not the same as in db", locVO.getProgramId().trim().equals("pgm5577"));
         //assertTrue("data is not the same as in db", locVO.getName().trim().equals("tmi"));
         assertTrue("childnre count is wrong", locVO.getLocationRequests().size() == 2);
      }
      catch (Exception ex) {
         log.warn("test failed", ex);
         fail("test failed with exception" + ex.toString());   
      }
      
   }



Config code.
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
   "hibernate-mapping-2.0.dtd">
<hibernate-mapping
   schema="fnduwdgen"
   package="com.texasmutual.onlinesystems.endorsements.vos">

  <class name="ChangeRequestVO" table="change_request">
      <composite-id>
         <key-property name="transactionId" column="transaction_id" type="string"/>
         <key-property name="transactionSequenceNum" column="transaction_sequence" type="int"/>
      </composite-id>
      <timestamp name="lastChgDate" column="change_request_last_chg_date"/>
      
      <list name="locationRequests" table="chg_req_location" batch-size="3">
         <key>
            <column name="transaction_id"/>
            <column name="transaction_sequence"/>
         </key>
         <index column="location_number" type="string"/>
         <one-to-many class="com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO"/>
      </list>
      
      <property name="code" column="change_request_code" type="int"/>
      <property name="reasonRejected" column="reason_rejected" type="string"/>
      <property name="programId" column="program_id" type="string"/>
      <property name="estCompletionDate" column="estimated_completion_date" type="string"/>
      <property name="dateCompleted" column="date_completed" type="date"/>
      
      <!-- audit fields -->
      <property name="createDate" column="change_request_create_date" type="timestamp"/>
      <property name="createUserId" column="change_request_create_userid" type="string"/>
      <property name="lastChgUserId" column="change_request_last_chg_userid" type="string"/>
      <!-- subclass information -->
   </class>

   <class name="LocationChgReqVO" table="chg_req_location">
      <composite-id>
         <key-property name="transactionId" column="transaction_id" type="string"/>
         <key-property name="transactionSequenceNum" column="transaction_sequence" type="int"/>
         <key-property name="locationNum" column="location_number" type="string"/>
      </composite-id>
      <timestamp name="lastChgDate" column="chg_location_last_chg_date"/>
      <property name="name" column="location_name" type="string"/>
      <property name="address1" column="location_address1" type="string"/>
      <property name="address2" column="location_address2" type="string"/>
      <property name="city" column="location_city" type="string"/>
      <property name="state" column="location_state" type="string"/>
      <property name="zip" column="location_zip" type="string"/>
      <property name="country" column="location_country" type="string"/>
      <property name="clientId" column="client_id" type="string"/>
      <property name="sortName" column="sort_name" type="string"/>
      <property name="phone" column="location_phone_number" type="string"/>
      <property name="fein" column="federal_employer_id_number" type="string"/>
      <property name="dbaName" column="dba_name" type="string"/>
      <property name="typeOfChange" column="type_of_change" type="char"/>
   </class>
</hibernate-mapping>


Parent class (with/ List):
Code:
public class ChangeRequestVO extends AbstractBaseVO {

   private String transactionId = null;
   private int transactionSequenceNum;
   private String code = null;
   private String reasonRejected = null;
   private String comments = null;
   private String programId = null;
   private String dateCompleted = null;
   private String estCompletionDate = null;
   [b]private List locationRequests = null;[/b]


Here are the logs:
[Loading parent here]
2004-02-04 11:21:00,600 DEBUG loader.Loader - result row: com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO@18b7b
2004-02-04 11:21:00,600 DEBUG loader.Loader - Initializing object from ResultSet: com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO@18b7b
2004-02-04 11:21:00,600 DEBUG loader.Loader - Hydrating entity: com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO#com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO@18b7b
2004-02-04 11:21:00,610 DEBUG type.TimestampType - returning '03 February 2004 22:32:48' as column: change_r3_0_
2004-02-04 11:21:00,620 DEBUG type.IntegerType - returning null as column: change_r4_0_
2004-02-04 11:21:00,620 DEBUG type.StringType - returning null as column: reason_r5_0_
2004-02-04 11:21:00,620 DEBUG type.StringType - returning 'pgm5577 ' as column: program_id0_
2004-02-04 11:21:00,620 DEBUG type.StringType - returning '01/01/04' as column: estimate7_0_
2004-02-04 11:21:00,620 DEBUG type.DateType - returning null as column: date_com8_0_
2004-02-04 11:21:00,620 DEBUG type.TimestampType - returning '01 January 2004 00:00:00' as column: change_r9_0_
2004-02-04 11:21:00,620 DEBUG type.StringType - returning 'pkode_test ' as column: change_10_0_
2004-02-04 11:21:00,620 DEBUG type.StringType - returning 'pkode_test ' as column: change_11_0_
2004-02-04 11:21:00,620 DEBUG impl.SessionImpl - Version: 2004-02-03 22:32:48.128
2004-02-04 11:21:00,620 DEBUG loader.Loader - done processing result set (1 rows)
2004-02-04 11:21:00,620 DEBUG impl.BatcherImpl - done closing: 0 open PreparedStatements, 0 open ResultSets
2004-02-04 11:21:00,620 DEBUG impl.BatcherImpl - closing statement
2004-02-04 11:21:01,161 DEBUG loader.Loader - total objects hydrated: 1
2004-02-04 11:21:01,161 DEBUG impl.SessionImpl - resolving associations for [com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO#com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO@18b7b]
2004-02-04 11:21:01,161 DEBUG impl.SessionImpl - collection not cached
2004-02-04 11:21:01,171 DEBUG impl.SessionImpl - initializing collection [com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO.locationRequests#com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO@18b7b]
2004-02-04 11:21:01,171 DEBUG impl.BatcherImpl - about to open: 0 open PreparedStatements, 0 open ResultSets
2004-02-04 11:21:01,171 DEBUG hibernate.SQL - select locationre0_.transaction_id as transact1___, locationre0_.transaction_sequence as transact2___, locationre0_.location_number as location3___, locationre0_.transaction_id as transact1_0_, locationre0_.transaction_sequence as transact2_0_, locationre0_.location_number as location3_0_, locationre0_.chg_location_last_chg_date as chg_loca4_0_, locationre0_.location_name as location5_0_, locationre0_.location_address1 as location6_0_, locationre0_.location_address2 as location7_0_, locationre0_.location_city as location8_0_, locationre0_.location_state as location9_0_, locationre0_.location_zip as locatio10_0_, locationre0_.location_country as locatio11_0_, locationre0_.client_id as client_id0_, locationre0_.sort_name as sort_name0_, locationre0_.location_phone_number as locatio14_0_, locationre0_.federal_employer_id_number as federal15_0_, locationre0_.dba_name as dba_name0_, locationre0_.type_of_change as type_of17_0_ from fnduwdgen.chg_req_location locationre0_ where locationre0_.transaction_id=? and locationre0_.transaction_sequence=?
2004-02-04 11:21:01,171 DEBUG impl.BatcherImpl - preparing statement
2004-02-04 11:21:01,481 DEBUG type.StringType - binding '1' to parameter: 1
2004-02-04 11:21:01,481 DEBUG type.IntegerType - binding '0' to parameter: 2
2004-02-04 11:21:01,501 DEBUG loader.Loader - result set contains (possibly empty) collection: [com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO.locationRequests#com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO@18b7b]
2004-02-04 11:21:01,501 DEBUG impl.SessionImpl - uninitialized collection: initializing
2004-02-04 11:21:01,501 DEBUG loader.Loader - processing result set
2004-02-04 11:21:01,501 DEBUG type.StringType - returning '1 ' as column: transact1_0_
2004-02-04 11:21:01,501 DEBUG type.IntegerType - returning '0' as column: transact2_0_
2004-02-04 11:21:01,501 DEBUG type.StringType - returning '123 ' as column: location3_0_
2004-02-04 11:21:01,511 DEBUG loader.Loader - result row: com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@43dc4
2004-02-04 11:21:01,511 DEBUG loader.Loader - Initializing object from ResultSet: com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@43dc4
2004-02-04 11:21:01,511 DEBUG loader.Loader - Hydrating entity: com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@43dc4
2004-02-04 11:21:01,511 DEBUG type.TimestampType - returning '03 February 2004 17:35:00' as column: chg_loca4_0_
2004-02-04 11:21:01,521 DEBUG type.StringType - returning 'tmi ' as column: location5_0_
2004-02-04 11:21:01,521 DEBUG type.StringType - returning '3679random address ' as column: location6_0_
2004-02-04 11:21:01,521 DEBUG type.StringType - returning null as column: location7_0_
2004-02-04 11:21:01,521 DEBUG type.StringType - returning 'austin ' as column: location8_0_
2004-02-04 11:21:01,521 DEBUG type.StringType - returning 'tx' as column: location9_0_
2004-02-04 11:21:01,521 DEBUG type.StringType - returning '78704 ' as column: locatio10_0_
2004-02-04 11:21:01,521 DEBUG type.StringType - returning 'US ' as column: locatio11_0_
2004-02-04 11:21:01,521 DEBUG type.StringType - returning null as column: client_id0_
2004-02-04 11:21:01,521 DEBUG type.StringType - returning null as column: sort_name0_
2004-02-04 11:21:01,521 DEBUG type.StringType - returning null as column: locatio14_0_
2004-02-04 11:21:01,521 DEBUG type.StringType - returning '111111111' as column: federal15_0_
2004-02-04 11:21:01,521 DEBUG type.StringType - returning null as column: dba_name0_
2004-02-04 11:21:01,521 DEBUG type.CharacterType - returning 'L' as column: type_of17_0_
2004-02-04 11:21:01,521 DEBUG impl.SessionImpl - Version: 2004-02-03 17:35:00.562
2004-02-04 11:21:01,521 DEBUG type.StringType - returning '1 ' as column: transact1___
2004-02-04 11:21:01,521 DEBUG type.IntegerType - returning '0' as column: transact2___
2004-02-04 11:21:01,521 DEBUG loader.Loader - found row of collection: [com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO.locationRequests#com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO@3ec4a]
2004-02-04 11:21:01,521 DEBUG impl.SessionImpl - new collection: instantiating
2004-02-04 11:21:01,521 DEBUG type.StringType - returning '1 ' as column: transact1___
2004-02-04 11:21:01,521 DEBUG type.IntegerType - returning '0' as column: transact2___
2004-02-04 11:21:01,521 DEBUG type.StringType - returning '123 ' as column: location3___
2004-02-04 11:21:01,521 DEBUG impl.SessionImpl - loading [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@3d8f6]
2004-02-04 11:21:01,521 DEBUG impl.SessionImpl - attempting to resolve [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@3d8f6]
2004-02-04 11:21:01,521 DEBUG impl.SessionImpl - object not resolved in any cache [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@3d8f6]
2004-02-04 11:21:01,521 DEBUG persister.EntityPersister - Materializing entity: [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@3d8f6]
2004-02-04 11:21:01,521 DEBUG impl.BatcherImpl - about to open: 1 open PreparedStatements, 1 open ResultSets
2004-02-04 11:21:01,531 DEBUG hibernate.SQL - select locationch0_.transaction_id as transact1_0_, locationch0_.transaction_sequence as transact2_0_, locationch0_.location_number as location3_0_, locationch0_.chg_location_last_chg_date as chg_loca4_0_, locationch0_.location_name as location5_0_, locationch0_.location_address1 as location6_0_, locationch0_.location_address2 as location7_0_, locationch0_.location_city as location8_0_, locationch0_.location_state as location9_0_, locationch0_.location_zip as locatio10_0_, locationch0_.location_country as locatio11_0_, locationch0_.client_id as client_id0_, locationch0_.sort_name as sort_name0_, locationch0_.location_phone_number as locatio14_0_, locationch0_.federal_employer_id_number as federal15_0_, locationch0_.dba_name as dba_name0_, locationch0_.type_of_change as type_of17_0_ from fnduwdgen.chg_req_location locationch0_ where locationch0_.transaction_id=? and locationch0_.transaction_sequence=? and locationch0_.location_number=?
2004-02-04 11:21:01,531 DEBUG impl.BatcherImpl - preparing statement
2004-02-04 11:21:01,571 DEBUG type.StringType - binding '1 ' to parameter: 1
2004-02-04 11:21:01,571 DEBUG type.IntegerType - binding '0' to parameter: 2
2004-02-04 11:21:01,571 DEBUG type.StringType - binding '123 ' to parameter: 3
2004-02-04 11:21:01,611 DEBUG loader.Loader - processing result set
2004-02-04 11:21:01,611 DEBUG loader.Loader - result row: com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@3d8f6
2004-02-04 11:21:01,611 DEBUG loader.Loader - Initializing object from ResultSet: com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@3d8f6
2004-02-04 11:21:01,611 DEBUG loader.Loader - Hydrating entity: com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@3d8f6
2004-02-04 11:21:01,611 DEBUG type.TimestampType - returning '03 February 2004 17:35:00' as column: chg_loca4_0_
2004-02-04 11:21:01,611 DEBUG type.StringType - returning 'tmi ' as column: location5_0_
2004-02-04 11:21:01,611 DEBUG type.StringType - returning '3679random address ' as column: location6_0_
2004-02-04 11:21:01,621 DEBUG type.StringType - returning null as column: location7_0_
2004-02-04 11:21:01,621 DEBUG type.StringType - returning 'austin ' as column: location8_0_
2004-02-04 11:21:01,621 DEBUG type.StringType - returning 'tx' as column: location9_0_
2004-02-04 11:21:01,621 DEBUG type.StringType - returning '78704 ' as column: locatio10_0_
2004-02-04 11:21:01,621 DEBUG type.StringType - returning 'US ' as column: locatio11_0_
2004-02-04 11:21:01,621 DEBUG type.StringType - returning null as column: client_id0_
2004-02-04 11:21:01,621 DEBUG type.StringType - returning null as column: sort_name0_
2004-02-04 11:21:01,621 DEBUG type.StringType - returning null as column: locatio14_0_
2004-02-04 11:21:01,621 DEBUG type.StringType - returning '111111111' as column: federal15_0_
2004-02-04 11:21:01,621 DEBUG type.StringType - returning null as column: dba_name0_
2004-02-04 11:21:01,621 DEBUG type.CharacterType - returning 'L' as column: type_of17_0_
2004-02-04 11:21:01,621 DEBUG impl.SessionImpl - Version: 2004-02-03 17:35:00.562
2004-02-04 11:21:01,621 DEBUG loader.Loader - done processing result set (1 rows)
2004-02-04 11:21:01,621 DEBUG impl.BatcherImpl - done closing: 1 open PreparedStatements, 1 open ResultSets
2004-02-04 11:21:01,621 DEBUG impl.BatcherImpl - closing statement

[Parent hydated here:]
2004-02-04 11:21:01,621 DEBUG loader.Loader - total objects hydrated: 1

[Loading children]
2004-02-04 11:21:01,621 DEBUG impl.SessionImpl - resolving associations for [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@3d8f6]
2004-02-04 11:21:01,621 DEBUG impl.SessionImpl - done materializing entity [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@3d8f6]
2004-02-04 11:21:01,631 DEBUG type.IntegerType - returning '123' as column: location3___
2004-02-04 11:21:01,631 DEBUG type.StringType - returning '1 ' as column: transact1_0_
2004-02-04 11:21:01,631 DEBUG type.IntegerType - returning '0' as column: transact2_0_
2004-02-04 11:21:01,631 DEBUG type.StringType - returning '321 ' as column: location3_0_
2004-02-04 11:21:01,631 DEBUG loader.Loader - result row: com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@f168
2004-02-04 11:21:01,631 DEBUG loader.Loader - Initializing object from ResultSet: com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@f168
2004-02-04 11:21:01,631 DEBUG loader.Loader - Hydrating entity: com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@f168
2004-02-04 11:21:01,631 DEBUG type.TimestampType - returning '01 January 2004 00:00:00' as column: chg_loca4_0_
2004-02-04 11:21:01,631 DEBUG type.StringType - returning 'work ' as column: location5_0_
2004-02-04 11:21:01,631 DEBUG type.StringType - returning '4815 Seton Pkwy ' as column: location6_0_
2004-02-04 11:21:01,631 DEBUG type.StringType - returning null as column: location7_0_
2004-02-04 11:21:01,631 DEBUG type.StringType - returning 'austin ' as column: location8_0_
2004-02-04 11:21:01,631 DEBUG type.StringType - returning 'tx' as column: location9_0_
2004-02-04 11:21:01,631 DEBUG type.StringType - returning '78759 ' as column: locatio10_0_
2004-02-04 11:21:01,631 DEBUG type.StringType - returning 'US ' as column: locatio11_0_
2004-02-04 11:21:01,631 DEBUG type.StringType - returning null as column: client_id0_
2004-02-04 11:21:01,631 DEBUG type.StringType - returning null as column: sort_name0_
2004-02-04 11:21:01,631 DEBUG type.StringType - returning null as column: locatio14_0_
2004-02-04 11:21:01,631 DEBUG type.StringType - returning '111111111' as column: federal15_0_
2004-02-04 11:21:01,631 DEBUG type.StringType - returning null as column: dba_name0_
2004-02-04 11:21:01,631 DEBUG type.CharacterType - returning 'T' as column: type_of17_0_
2004-02-04 11:21:01,631 DEBUG impl.SessionImpl - Version: 2004-01-01 00:00:00.0
2004-02-04 11:21:01,631 DEBUG type.StringType - returning '1 ' as column: transact1___
2004-02-04 11:21:01,631 DEBUG type.IntegerType - returning '0' as column: transact2___
2004-02-04 11:21:01,631 DEBUG loader.Loader - found row of collection: [com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO.locationRequests#com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO@26255]
2004-02-04 11:21:01,631 DEBUG impl.SessionImpl - new collection: instantiating
2004-02-04 11:21:01,631 DEBUG type.StringType - returning '1 ' as column: transact1___
2004-02-04 11:21:01,631 DEBUG type.IntegerType - returning '0' as column: transact2___
2004-02-04 11:21:01,631 DEBUG type.StringType - returning '321 ' as column: location3___
2004-02-04 11:21:01,631 DEBUG impl.SessionImpl - loading [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@1362d]
2004-02-04 11:21:01,631 DEBUG impl.SessionImpl - attempting to resolve [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@1362d]
2004-02-04 11:21:01,631 DEBUG impl.SessionImpl - object not resolved in any cache [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@1362d]
2004-02-04 11:21:01,631 DEBUG persister.EntityPersister - Materializing entity: [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@1362d]
2004-02-04 11:21:01,631 DEBUG impl.BatcherImpl - about to open: 1 open PreparedStatements, 1 open ResultSets
2004-02-04 11:21:01,631 DEBUG hibernate.SQL - select locationch0_.transaction_id as transact1_0_, locationch0_.transaction_sequence as transact2_0_, locationch0_.location_number as location3_0_, locationch0_.chg_location_last_chg_date as chg_loca4_0_, locationch0_.location_name as location5_0_, locationch0_.location_address1 as location6_0_, locationch0_.location_address2 as location7_0_, locationch0_.location_city as location8_0_, locationch0_.location_state as location9_0_, locationch0_.location_zip as locatio10_0_, locationch0_.location_country as locatio11_0_, locationch0_.client_id as client_id0_, locationch0_.sort_name as sort_name0_, locationch0_.location_phone_number as locatio14_0_, locationch0_.federal_employer_id_number as federal15_0_, locationch0_.dba_name as dba_name0_, locationch0_.type_of_change as type_of17_0_ from fnduwdgen.chg_req_location locationch0_ where locationch0_.transaction_id=? and locationch0_.transaction_sequence=? and locationch0_.location_number=?
2004-02-04 11:21:01,631 DEBUG impl.BatcherImpl - preparing statement
2004-02-04 11:21:01,641 DEBUG type.StringType - binding '1 ' to parameter: 1
2004-02-04 11:21:01,641 DEBUG type.IntegerType - binding '0' to parameter: 2
2004-02-04 11:21:01,641 DEBUG type.StringType - binding '321 ' to parameter: 3
2004-02-04 11:21:01,662 DEBUG loader.Loader - processing result set
2004-02-04 11:21:01,662 DEBUG loader.Loader - result row: com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@1362d
2004-02-04 11:21:01,662 DEBUG loader.Loader - Initializing object from ResultSet: com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@1362d
2004-02-04 11:21:01,662 DEBUG loader.Loader - Hydrating entity: com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@1362d
2004-02-04 11:21:01,662 DEBUG type.TimestampType - returning '01 January 2004 00:00:00' as column: chg_loca4_0_
2004-02-04 11:21:01,662 DEBUG type.StringType - returning 'work ' as column: location5_0_
2004-02-04 11:21:01,662 DEBUG type.StringType - returning '4815 Seton Pkwy ' as column: location6_0_
2004-02-04 11:21:01,662 DEBUG type.StringType - returning null as column: location7_0_
2004-02-04 11:21:01,662 DEBUG type.StringType - returning 'austin ' as column: location8_0_
2004-02-04 11:21:01,662 DEBUG type.StringType - returning 'tx' as column: location9_0_
2004-02-04 11:21:01,662 DEBUG type.StringType - returning '78759 ' as column: locatio10_0_
2004-02-04 11:21:01,662 DEBUG type.StringType - returning 'US ' as column: locatio11_0_
2004-02-04 11:21:01,662 DEBUG type.StringType - returning null as column: client_id0_
2004-02-04 11:21:01,662 DEBUG type.StringType - returning null as column: sort_name0_
2004-02-04 11:21:01,662 DEBUG type.StringType - returning null as column: locatio14_0_
2004-02-04 11:21:01,662 DEBUG type.StringType - returning '111111111' as column: federal15_0_
2004-02-04 11:21:01,662 DEBUG type.StringType - returning null as column: dba_name0_
2004-02-04 11:21:01,662 DEBUG type.CharacterType - returning 'T' as column: type_of17_0_
2004-02-04 11:21:01,662 DEBUG impl.SessionImpl - Version: 2004-01-01 00:00:00.0
2004-02-04 11:21:01,662 DEBUG loader.Loader - done processing result set (1 rows)
2004-02-04 11:21:01,662 DEBUG impl.BatcherImpl - done closing: 1 open PreparedStatements, 1 open ResultSets
2004-02-04 11:21:01,662 DEBUG impl.BatcherImpl - closing statement
2004-02-04 11:21:01,662 DEBUG loader.Loader - total objects hydrated: 1
2004-02-04 11:21:01,662 DEBUG impl.SessionImpl - resolving associations for [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@1362d]
2004-02-04 11:21:01,662 DEBUG impl.SessionImpl - done materializing entity [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@1362d]
2004-02-04 11:21:01,672 DEBUG type.IntegerType - returning '321' as column: location3___
2004-02-04 11:21:01,672 DEBUG loader.Loader - done processing result set (2 rows)
2004-02-04 11:21:01,672 DEBUG impl.BatcherImpl - done closing: 0 open PreparedStatements, 0 open ResultSets
2004-02-04 11:21:01,672 DEBUG impl.BatcherImpl - closing statement
2004-02-04 11:21:01,672 DEBUG loader.Loader - total objects hydrated: 2
[Children hydrated]

2004-02-04 11:21:01,672 DEBUG impl.SessionImpl - resolving associations for [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@43dc4]
2004-02-04 11:21:01,672 DEBUG impl.SessionImpl - done materializing entity [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@43dc4]
2004-02-04 11:21:01,672 DEBUG impl.SessionImpl - resolving associations for [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@f168]
2004-02-04 11:21:01,672 DEBUG impl.SessionImpl - done materializing entity [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO@f168]
2004-02-04 11:21:01,672 DEBUG impl.SessionImpl - 3 collections were found in result set
2004-02-04 11:21:01,672 DEBUG impl.SessionImpl - collection fully initialized: [com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO.locationRequests#com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO@18b7b]
2004-02-04 11:21:01,672 DEBUG impl.SessionImpl - collection fully initialized: [com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO.locationRequests#com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO@3ec4a]
2004-02-04 11:21:01,672 DEBUG impl.SessionImpl - collection fully initialized: [com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO.locationRequests#com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO@26255]
2004-02-04 11:21:01,672 DEBUG impl.SessionImpl - 3 collections initialized
2004-02-04 11:21:01,672 DEBUG vos.ChangeRequestVO - [Setting the locations[]]
2004-02-04 11:21:01,672 DEBUG impl.SessionImpl - done materializing entity [com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO#com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO@18b7b]
2004-02-04 11:21:01,672 DEBUG impl.SessionImpl - initializing non-lazy collections
2004-02-04 11:21:01,672 DEBUG impl.SessionImpl - closing session
2004-02-04 11:21:01,672 DEBUG impl.SessionImpl - disconnecting session
2004-02-04 11:21:01,682 DEBUG connection.DriverManagerConnectionProvider - returning connection to pool, pool size: 1
2004-02-04 11:21:01,682 DEBUG impl.SessionImpl - transaction completion
2004-02-04 11:21:01,682 DEBUG tests.AbstractEndorsementsTest - Program id is 'pgm5577 '


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2004 3:33 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
We did not meant to replace HashSet by TreeSet, just remove the new HashSet() code .

If you want to add a new hashset, then do
Code:
HashSet newHashSet = new HashSet();
myObject.setMycollection(newHashSet());

Infinite loop is almost always the sign of a failing or missing equals hashcode.

Read material on that subject on the wiki area.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2004 3:39 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Why don't you like the HashSet() in the variable declaration? :)

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


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2004 5:31 pm 
Newbie

Joined: Wed Feb 04, 2004 1:25 am
Posts: 8
I tried both ways. With the '= new HashSet()'; and 'with = null' to no avail. But I think the problem is beyond the HashSet.

I even changed the one-to-many collection to a List (w/ private List children = null; in the parent. code provided in the above posting). I also switched to using List b/c the use-case asks for sequencing. I still see from the logs that the rows are being returned by the query and also see the LocationChgReq objects references in the log (2 for the 2 rows in the db)... but they are not getting populated in the List. Do i need indexed getters and setters on the child attrbute. i.e

Code:
public LocationChgReqVO getLocationRequests(int index);
public void set(int index, LocationChgReqVO);


I will also retest w/ the HashSet (correcting the hashCode impl) in the mean time.

pratap.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2004 7:11 pm 
Newbie

Joined: Wed Feb 04, 2004 1:25 am
Posts: 8
okay... i put some debug statements in the hashCode implementation and looks like the method is doing what it is supposed to do. I also overrode the toString() method to return the key(composite) of the object.

Please let me know if you see something amiss.

thanks,
pratap.

2004-02-04 17:07:55,683 DEBUG impl.SessionImpl - resolving associations for [com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO#com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO@30a6e56c]
2004-02-04 17:07:55,683 DEBUG impl.SessionImpl - collection not cached
2004-02-04 17:07:55,703 DEBUG impl.SessionImpl - initializing collection [com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO.locationRequests#com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO@30a6e56c]
2004-02-04 17:07:55,703 DEBUG vos.ChangeRequestVO - [Calling getter. returning value '1']
2004-02-04 17:07:55,703 DEBUG vos.ChangeRequestVO - [Calling getter. returning value '1']
2004-02-04 17:07:55,703 DEBUG impl.BatcherImpl - about to open: 0 open PreparedStatements, 0 open ResultSets
2004-02-04 17:07:55,703 DEBUG hibernate.SQL - select locationre0_.transaction_id as transact1___, locationre0_.transaction_sequence as transact2___, locationre0_.location_number as location3___, locationre0_.transaction_id as transact1_0_, locationre0_.transaction_sequence as transact2_0_, locationre0_.location_number as location3_0_, locationre0_.chg_location_last_chg_date as chg_loca4_0_, locationre0_.location_name as location5_0_, locationre0_.location_address1 as location6_0_, locationre0_.location_address2 as location7_0_, locationre0_.location_city as location8_0_, locationre0_.location_state as location9_0_, locationre0_.location_zip as locatio10_0_, locationre0_.location_country as locatio11_0_, locationre0_.client_id as client_id0_, locationre0_.sort_name as sort_name0_, locationre0_.location_phone_number as locatio14_0_, locationre0_.federal_employer_id_number as federal15_0_, locationre0_.dba_name as dba_name0_, locationre0_.type_of_change as type_of17_0_ from fnduwdgen.chg_req_location locationre0_ where locationre0_.transaction_id=? and locationre0_.transaction_sequence=?
2004-02-04 17:07:55,703 DEBUG impl.BatcherImpl - preparing statement
2004-02-04 17:07:55,913 DEBUG vos.ChangeRequestVO - [Calling getter. returning value '1']
2004-02-04 17:07:55,913 DEBUG type.StringType - binding '1' to parameter: 1
2004-02-04 17:07:55,913 DEBUG type.IntegerType - binding '0' to parameter: 2
2004-02-04 17:07:55,923 DEBUG loader.Loader - result set contains (possibly empty) collection: [com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO.locationRequests#com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO@30a6e56c]
2004-02-04 17:07:55,923 DEBUG vos.ChangeRequestVO - [Calling getter. returning value '1']
2004-02-04 17:07:55,923 DEBUG vos.ChangeRequestVO - [Calling getter. returning value '1']
2004-02-04 17:07:55,923 DEBUG impl.SessionImpl - uninitialized collection: initializing
2004-02-04 17:07:55,923 DEBUG loader.Loader - processing result set
2004-02-04 17:07:55,923 DEBUG type.StringType - returning '1 ' as column: transact1_0_
2004-02-04 17:07:55,923 DEBUG type.IntegerType - returning '0' as column: transact2_0_
2004-02-04 17:07:55,923 DEBUG type.StringType - returning '123 ' as column: location3_0_
2004-02-04 17:07:55,923 DEBUG loader.Loader - result row: LocationObject Key(1 :123 :0)
2004-02-04 17:07:55,923 DEBUG vos.LocationChgReqVO - [HashCode called for LocationObject Key(1 :123 :0) returned value: -1775989183
2004-02-04 17:07:55,923 DEBUG loader.Loader - Initializing object from ResultSet: LocationObject Key(1 :123 :0)
2004-02-04 17:07:55,923 DEBUG vos.LocationChgReqVO - [HashCode called for LocationObject Key(1 :123 :0) returned value: -1775989183
2004-02-04 17:07:55,923 DEBUG vos.LocationChgReqVO - [HashCode called for LocationObject Key(1 :123 :0) returned value: -1775989183

2004-02-04 17:07:55,923 DEBUG loader.Loader - Hydrating entity: com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#LocationObject Key(1 :123 :0)
2004-02-04 17:07:55,933 DEBUG type.TimestampType - returning '03 February 2004 17:35:00' as column: chg_loca4_0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning 'tmi ' as column: location5_0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning '3679random address ' as column: location6_0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning null as column: location7_0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning 'austin ' as column: location8_0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning 'tx' as column: location9_0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning '78704 ' as column: locatio10_0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning 'US ' as column: locatio11_0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning null as column: client_id0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning null as column: sort_name0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning null as column: locatio14_0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning '111111111' as column: federal15_0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning null as column: dba_name0_
2004-02-04 17:07:55,933 DEBUG type.CharacterType - returning 'L' as column: type_of17_0_
2004-02-04 17:07:55,933 DEBUG impl.SessionImpl - Version: 2004-02-03 17:35:00.562
2004-02-04 17:07:55,933 DEBUG type.StringType - returning '1 ' as column: transact1___
2004-02-04 17:07:55,933 DEBUG type.IntegerType - returning '0' as column: transact2___
2004-02-04 17:07:55,933 DEBUG vos.ChangeRequestVO - [Calling setter. setting value '1 ']
2004-02-04 17:07:55,933 DEBUG loader.Loader - found row of collection: [com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO.locationRequests#com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO@521a256f]
2004-02-04 17:07:55,933 DEBUG impl.SessionImpl - new collection: instantiating
2004-02-04 17:07:55,933 DEBUG type.StringType - returning '1 ' as column: transact1___
2004-02-04 17:07:55,933 DEBUG type.IntegerType - returning '0' as column: transact2___
2004-02-04 17:07:55,933 DEBUG type.StringType - returning '123 ' as column: location3___
2004-02-04 17:07:55,933 DEBUG impl.SessionImpl - loading [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#LocationObject Key(1 :123 :0)]
2004-02-04 17:07:55,933 DEBUG impl.SessionImpl - attempting to resolve [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#LocationObject Key(1 :123 :0)]
2004-02-04 17:07:55,933 DEBUG vos.LocationChgReqVO - [HashCode called for LocationObject Key(1 :123 :0) returned value: -1775989183
2004-02-04 17:07:55,933 DEBUG impl.SessionImpl - resolved object in session cache [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#LocationObject Key(1 :123 :0)]
2004-02-04 17:07:55,933 DEBUG type.StringType - returning '1 ' as column: transact1_0_
2004-02-04 17:07:55,933 DEBUG type.IntegerType - returning '0' as column: transact2_0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning '321 ' as column: location3_0_
2004-02-04 17:07:55,933 DEBUG loader.Loader - result row: LocationObject Key(1 :321 :0)
2004-02-04 17:07:55,933 DEBUG vos.LocationChgReqVO - [HashCode called for LocationObject Key(1 :321 :0) returned value: -1774144063
2004-02-04 17:07:55,933 DEBUG loader.Loader - Initializing object from ResultSet: LocationObject Key(1 :321 :0)
2004-02-04 17:07:55,933 DEBUG vos.LocationChgReqVO - [HashCode called for LocationObject Key(1 :321 :0) returned value: -1774144063
2004-02-04 17:07:55,933 DEBUG vos.LocationChgReqVO - [HashCode called for LocationObject Key(1 :321 :0) returned value: -1774144063

2004-02-04 17:07:55,933 DEBUG loader.Loader - Hydrating entity: com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#LocationObject Key(1 :321 :0)
2004-02-04 17:07:55,933 DEBUG type.TimestampType - returning '01 January 2004 00:00:00' as column: chg_loca4_0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning 'work ' as column: location5_0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning '4815 Seton Pkwy ' as column: location6_0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning null as column: location7_0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning 'austin ' as column: location8_0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning 'tx' as column: location9_0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning '78759 ' as column: locatio10_0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning 'US ' as column: locatio11_0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning null as column: client_id0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning null as column: sort_name0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning null as column: locatio14_0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning '111111111' as column: federal15_0_
2004-02-04 17:07:55,933 DEBUG type.StringType - returning null as column: dba_name0_
2004-02-04 17:07:55,933 DEBUG type.CharacterType - returning 'T' as column: type_of17_0_
2004-02-04 17:07:55,933 DEBUG impl.SessionImpl - Version: 2004-01-01 00:00:00.0
2004-02-04 17:07:55,933 DEBUG type.StringType - returning '1 ' as column: transact1___
2004-02-04 17:07:55,933 DEBUG type.IntegerType - returning '0' as column: transact2___
2004-02-04 17:07:55,933 DEBUG vos.ChangeRequestVO - [Calling setter. setting value '1 ']
2004-02-04 17:07:55,933 DEBUG loader.Loader - found row of collection: [com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO.locationRequests#com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO@14c9a56f]
2004-02-04 17:07:55,933 DEBUG impl.SessionImpl - new collection: instantiating
2004-02-04 17:07:55,933 DEBUG type.StringType - returning '1 ' as column: transact1___
2004-02-04 17:07:55,933 DEBUG type.IntegerType - returning '0' as column: transact2___
2004-02-04 17:07:55,933 DEBUG type.StringType - returning '321 ' as column: location3___
2004-02-04 17:07:55,933 DEBUG impl.SessionImpl - loading [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#LocationObject Key(1 :321 :0)]
2004-02-04 17:07:55,933 DEBUG impl.SessionImpl - attempting to resolve [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#LocationObject Key(1 :321 :0)]
2004-02-04 17:07:55,933 DEBUG vos.LocationChgReqVO - [HashCode called for LocationObject Key(1 :321 :0) returned value: -1774144063

2004-02-04 17:07:55,933 DEBUG impl.SessionImpl - resolved object in session cache [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#LocationObject Key(1 :321 :0)]
2004-02-04 17:07:55,933 DEBUG loader.Loader - done processing result set (2 rows)
2004-02-04 17:07:55,943 DEBUG impl.BatcherImpl - done closing: 0 open PreparedStatements, 0 open ResultSets
2004-02-04 17:07:55,943 DEBUG impl.BatcherImpl - closing statement
2004-02-04 17:07:55,943 DEBUG loader.Loader - total objects hydrated: 2
2004-02-04 17:07:55,943 DEBUG impl.SessionImpl - resolving associations for [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#LocationObject Key(1 :123 :0)]
2004-02-04 17:07:55,943 DEBUG impl.SessionImpl - done materializing entity [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#LocationObject Key(1 :123 :0)]
2004-02-04 17:07:55,943 DEBUG impl.SessionImpl - resolving associations for [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#LocationObject Key(1 :321 :0)]
2004-02-04 17:07:55,943 DEBUG impl.SessionImpl - done materializing entity [com.texasmutual.onlinesystems.endorsements.vos.LocationChgReqVO#LocationObject Key(1 :321 :0)]
2004-02-04 17:07:55,943 DEBUG impl.SessionImpl - 3 collections were found in result set
2004-02-04 17:07:55,943 DEBUG impl.SessionImpl - collection fully initialized: [com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO.locationRequests#com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO@30a6e56c]
2004-02-04 17:07:55,943 DEBUG vos.LocationChgReqVO - [HashCode called for LocationObject Key(1 :123 :0) returned value: -1775989183
2004-02-04 17:07:55,943 DEBUG vos.LocationChgReqVO - [HashCode called for LocationObject Key(1 :123 :0) returned value: -1775989183
2004-02-04 17:07:55,943 DEBUG impl.SessionImpl - collection fully initialized: [com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO.locationRequests#com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO@521a256f]
2004-02-04 17:07:55,943 DEBUG vos.LocationChgReqVO - [HashCode called for LocationObject Key(1 :321 :0) returned value: -1774144063
2004-02-04 17:07:55,943 DEBUG vos.LocationChgReqVO - [HashCode called for LocationObject Key(1 :321 :0) returned value: -1774144063

2004-02-04 17:07:55,943 DEBUG impl.SessionImpl - collection fully initialized: [com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO.locationRequests#com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO@14c9a56f]
2004-02-04 17:07:55,943 DEBUG impl.SessionImpl - 3 collections initialized
2004-02-04 17:07:55,943 DEBUG vos.ChangeRequestVO - [Setting the locations[]]
2004-02-04 17:07:55,943 DEBUG impl.SessionImpl - done materializing entity [com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO#com.texasmutual.onlinesystems.endorsements.vos.ChangeRequestVO@30a6e56c]
2004-02-04 17:07:55,943 DEBUG impl.SessionImpl - initializing non-lazy collections
2004-02-04 17:07:55,943 DEBUG impl.SessionImpl - closing session
2004-02-04 17:07:55,943 DEBUG impl.SessionImpl - disconnecting session
2004-02-04 17:07:55,943 DEBUG connection.DriverManagerConnectionProvider - returning connection to pool, pool size: 1
2004-02-04 17:07:55,943 DEBUG impl.SessionImpl - transaction completion


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 05, 2004 6:49 pm 
Newbie

Joined: Wed Feb 04, 2004 1:25 am
Posts: 8
ok... finally found out what was wrong... I also found some inconsistency in the framework... or maybe its just my misunderstanding...I hope somebody can clarify the situation....

one of the id fields of the parent in the db is a 22 char string. my test data only populated one character of this data. so the db right padded spaces in the field.

Tests:
1) performed a load of the parent by passing in the key ("1"). the load of the parent worked fine i.e the "1" in code matched the '1<21-spaces-here>' in the database. I was able to read all the info for the parent and none of my asserts broke with the parent. but the load of the children with the same key "1" broke even though the children had the foreign key of '1<21-spaces-here>' in their records (needs to be there b/c there is ref constraint in db).
My question is why did the load of the parent work and not the children?

2) I created a new record with all the 22 chars filled for the key and the tests worked. saw consistency in loads for both the parent and children.

thanks again to everyone for the help. kudos for keeping the open source world up and running.

pratap.


Top
 Profile  
 
 Post subject: Thank you
PostPosted: Thu Jul 08, 2004 10:57 am 
Newbie

Joined: Mon May 24, 2004 8:34 am
Posts: 5
Can't thank you enough for your posts for this error you mentioned. I spent hours looking for a solution to this problem, and when I filled out my keys to be the full length of CHARACTERS as specified in the database, then loading of the parent object populated the children fine.

The odd thing I find is that it appears that within the hibernate.log file, the children appear to be found when the the primary_key is not the full length as required by the database. So if the children are being found, then why are they not added to the collection within the parent object.

Either way, when I padded out the key fields to be the full length of as specified in the database, then the collection of children populated as expected when loading the parent object.

Best Regards

Matt Gaunt


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