-->
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.  [ 4 posts ] 
Author Message
 Post subject: lazy=true seems to be ignored in a one-to-many association
PostPosted: Wed Apr 13, 2005 10:49 pm 
Newbie

Joined: Mon Feb 14, 2005 10:59 am
Posts: 3
Location: Wilmington, DE
ISSUE: This application has a bi-directional association mapped between two objects: Alerts & AlertRecipients. An Alert includes a one-to-many set of AlertRecipients, and an AlertRecipient has a many-to-one Alert field. The issue that I am having is that by querying for Alerts using the list() method of a Criteria object, all of the AlertRecipients are being loaded -- even though the Alert mapping has lazy=true. This is a problem because there can be 50,000 recipients per alert and the query is taking longer than a minute to return. Recipients are not even needed as part of the results. Any help you can give will be very greatly appreciated.

Hibernate version: 2.0

Mapping documents:
hibernate.cfg.xml
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 2.0//EN"

"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>

    <session-factory>
        <property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
        <property name="show_sql">true</property>
        <property name="transaction.factory_class">
             net.sf.hibernate.transaction.JDBCTransactionFactory
        </property>
        <property name="hibernate.cache.provider_class">
             net.sf.hibernate.cache.HashtableCacheProvider
        </property>
        <property name="hibernate.jdbc.batch_size">20</property>
        <property name="hibernate.max_fetch_depth">2</property>
        <property name="hibernate.hbm2ddl.auto">update</property>
        <property name="connection.datasource">java:comp/env/jdbc/nssir</property>
        <property name="hibernate.cglib.use_reflection_optimizer">false</property>
       
        <mapping resource="com/concordefs/starstation/alerts/Alert.hbm.xml"/>
        <mapping resource="com/concordefs/starstation/alerts/AlertRecipient.hbm.xml"/>

    </session-factory>

</hibernate-configuration>


Alert.hbm.xml
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>

        <class name="com.concordefs.starstation.alerts.Alert" table="ir_alerts">
                <id name="id" column="alert_id" type="long" unsaved-value="0">
                        <generator class="increment"/>
                </id>
                <property name="title" column="alert_title"/>
                <property name="message" column="alert_message" type="string" not-null="false"/>
                <property name="description" column="alert_description"/>
                <property name="status" column="alert_status"/>
                <property name="aeMsgSent" column="alert_ae_msg_sent"/>
                <property name="startDate" column="alert_datetime_start"/>
                <property name="expirationDate" column="alert_datetime_expire"/>
                <property name="followupRequired" column="alert_followup_required"/>
                <property name="followupCompletedDate" column="alert_followup_completed_datetime"/>
                <property name="mailingListFilename" column="alert_mailinglist_filename"/>
                <property name="mailingListCriteria" column="alert_mailinglist_criteria"/>
                <property name="submittedDate" column="alert_submitted_date"/>
                <property name="submittedUser" column="alert_submitted_user"/>               
                <property name="saveAfterExpiration" column="alert_save_after_expire"/>
                <property name="lastModifiedUser" column="alert_lastmodified_user"/>
                <set name="recipients" inverse="true" cascade="all-delete-orphan" lazy="true">
                        <key column="alert_id"/>
                        <one-to-many class="com.concordefs.starstation.alerts.AlertRecipient"/>
                </set>                               
        </class>

</hibernate-mapping>


AlertRecipient.hbm.xml
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>

        <class name="com.concordefs.starstation.alerts.AlertRecipient" table="ir_alert_users">
                        <id name="id" column="alert_user_id" type="long" unsaved-value="0">
                        <generator class="increment"/>
                </id>
                <property name="userID" column="user_id" type="string"/>
                <property name="userStatus" column="alert_user_status" type="string"/>
                <property name="communicationInfo" column="alert_user_communication" type="string"/>
                <property name="communicationType" column="alert_user_comm_type" type="string"/>
                <many-to-one name="alert" class="com.concordefs.starstation.alerts.Alert" column="alert_id" />
        </class>

</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
Not explicitly opening & closing sessions; using HibernateTemplate instead.
Here's the method that creates the query:

Code:
   /**
    * @param formCriteria The AlertSearchCriteria to use to query the database.
    * @return A collection of all Alerts contained in the database that match the criteria.
    */
   public List getAlertsByCriteria(AlertSearchCriteria formCriteria) throws Exception {

      List alerts = null;
      try {
         log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): getting criteria object (for Alert.class) from HibernateTemplate <<");
         Criteria searchCriteria = (Criteria) getHibernateTemplate().createCriteria(getSession(),com.concordefs.starstation.alerts.Alert.class);
         log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): got criteria object from HibernateTemplate; now setting criteria... <<");
         
           /** User ID **/
           if(formCriteria.getUserID().equalsIgnoreCase("ALL")){
              log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): USERID = ALL <<");
           }
           else {
              searchCriteria = searchCriteria.createAlias("recipients","recipient");
              searchCriteria.add(Expression.eq("recipient.userID", formCriteria.getUserID()));
              log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): USERID = " + formCriteria.getUserID() + " <<");

          /** Include Snoozed Alerts **/
              if(formCriteria.isIncludeSnoozed()) {                 
                 searchCriteria.add(Expression.not(Expression.eq("recipient.userStatus", "K"))); //show New (N) and Snoozed (Z); not Acknowledged (K).
                 log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): INCLUDING SNOOZED ALERTS <<");
               
              }
              else {
                 searchCriteria.add(Expression.eq("recipient.userStatus", "N")); //show only New (N).
                 log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): NOT INCLUDING SNOOZED ALERTS <<");
                             }
           }
          
           /** Alert Status **/
          if(formCriteria.getStatus().equalsIgnoreCase(AlertSearchCriteria.STATUS_CANCELLED)) {
             // returns cancelled alerts: status = "C" AND marked to be saved after expiration.
             searchCriteria.add(Expression.and(
                   Expression.eq("status", "C"), Expression.eq("saveAfterExpiration", new Integer(1))));             
             log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): STATUS = CANCELLED <<");
          }
          else if(formCriteria.getStatus().equalsIgnoreCase(AlertSearchCriteria.STATUS_ACTIVE)) {
             // returns active alerts: status = "A" AND start date/time <= now AND expiration date/time > now.
             searchCriteria.add(Expression.and(
                   Expression.eq("status", "A"), Expression.and(
                         Expression.le("startDate", new Date()), Expression.gt("expirationDate", new Date()))));             
             log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): STATUS = ACTIVE <<");
          }
           else if(formCriteria.getStatus().equalsIgnoreCase(AlertSearchCriteria.STATUS_EXPIRED)) {
             // returns expired alerts: status = "E" AND marked to be saved after expiration.
             searchCriteria.add(Expression.or(
                   Expression.and(Expression.eq("status", "A"), Expression.le("expirationDate", new Date())),
                  Expression.and(Expression.eq("status", "E"), Expression.eq("saveAfterExpiration", new Integer(1)))));             
             log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): STATUS = EXPIRED <<");
           }
           else if(formCriteria.getStatus().equalsIgnoreCase(AlertSearchCriteria.STATUS_PENDING)) {
             // returns future/pending alerts: status = "A" AND start date/time > now.
             searchCriteria.add(Expression.and(
                   Expression.eq("status", "A"), Expression.gt("startDate", new Date())));             
             log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): STATUS = PENDING <<");
           }
           else if(formCriteria.getStatus().equalsIgnoreCase(AlertSearchCriteria.STATUS_SAVED)) {
             // returns saved alerts: status = "S".
             searchCriteria.add(Expression.eq("status", "S"));
             log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): STATUS = SAVED <<");
           else if(formCriteria.getStatus().equalsIgnoreCase(AlertSearchCriteria.STATUS_CURRENT_EXPIRED)) {
             // returns active & expired alerts: (status = "A" AND start date/time <= now AND expiration date/time > now) OR (status = "E" AND marked to be saved after expiration).
              searchCriteria.add(Expression.or(
                    Expression.and(Expression.eq("status", "A"), Expression.and(
                          Expression.le("startDate", new Date()), Expression.gt("expirationDate", new Date()))), Expression.and(
                                Expression.eq("status", "E"), Expression.eq("saveAfterExpiration", new Integer(1)))));
              log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): STATUS = CURRENT/EXPIRED <<");
           }
           else if(formCriteria.getStatus().equalsIgnoreCase(AlertSearchCriteria.STATUS_NEWLY_EXPIRED)) {
             // returns alerts which expired that day: (status = "A" AND expiration date/time <= now)
              // this method will probably only be called by AlertFinalizer.
              searchCriteria.add(Expression.and(
                    Expression.eq("status", "A"), Expression.le("expirationDate", new Date())));
              log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): STATUS = NEWLY EXPIRED <<");
           }
          else { //STATUS_ANY -- add no additional criteria.
             // returns all alerts (excludes expired alerts who were not marked to be saved after expiration).
             searchCriteria.add(Expression.not(
                   Expression.and(
                          Expression.eq("status", "E"), Expression.eq("saveAfterExpiration", new Integer(0)))));
             log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): STATUS = ANY <<");
          }
          
           /** Alert ID **/
          if(!formCriteria.getAlertID().equals("")) {
             searchCriteria.add(Expression.eq("id", Long.valueOf(formCriteria.getAlertID())));
             log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): ALERT ID = " + formCriteria.getAlertID() + " <<");
          }
          
           /** Alert Title **/
          if(!formCriteria.getTitle().equals("")) {
              if(formCriteria.getTitleOperator().equalsIgnoreCase(AlertSearchCriteria.TITLE_BEGINS)){
                 searchCriteria.add(Expression.ilike("title", formCriteria.getTitle().trim(),MatchMode.START));
                 log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): TITLE BEGINS WITH = " + formCriteria.getTitle() + " <<");
              }
              else { // AlertSearchCriteria.TITLE_CONTAINS
                 searchCriteria.add(Expression.ilike("title", formCriteria.getTitle().trim(),MatchMode.ANYWHERE));
                 log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): TITLE CONTAINS = " + formCriteria.getTitle() + " <<");
              }                        
           }

           /** Alert Start Date (logging done in addDateCriteria) **/
           if(formCriteria.getStartDate() != null) addDateCriteria(searchCriteria, "startDate", formCriteria.getStartDate(), formCriteria.getStartDateOperator());
          
           /** Alert Expiration Date (logging done in addDateCriteria) **/
           if(formCriteria.getExpirationDate() != null) addDateCriteria(searchCriteria, "expirationDate", formCriteria.getExpirationDate(), formCriteria.getExpirationDateOperator());
          
           /** Include only those marked to be saved after expiration **/
           if(formCriteria.isIncludeOnlySaveAfterExpiration()){
              searchCriteria.add(Expression.eq("saveAfterExpiration", "1"));
              log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): INCLUDE ONLY ALERTS TO BE SAVED AFTER EXPIRATION <<");
           }
          
           /** sort by **/
           if(formCriteria.getSortBy().equalsIgnoreCase(AlertSearchCriteria.SORTBY_DESCRIPTION)){
              if(formCriteria.getSortOrder().equalsIgnoreCase(AlertSearchCriteria.SORT_ORDER_DESC)){
                 searchCriteria.addOrder(Order.desc("description"));
                 log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): ORDER BY description; DESCENDING <<");
              }
              else{
               searchCriteria.addOrder(Order.asc("description"));
               log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): ORDER BY description; ASCENDING <<");
              }            
           }
           else if(formCriteria.getSortBy().equalsIgnoreCase(AlertSearchCriteria.SORTBY_STARTDATE)){
              if(formCriteria.getSortOrder().equalsIgnoreCase(AlertSearchCriteria.SORT_ORDER_DESC)){
                 searchCriteria.addOrder(Order.desc("startDate"));
                 log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): ORDER BY startDate; DESCENDING <<");
              }
              else{
                 searchCriteria.addOrder(Order.asc("startDate"));
               log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): ORDER BY startDate; ASCENDING <<");
              }
           }
           else if(formCriteria.getSortBy().equalsIgnoreCase(AlertSearchCriteria.SORTBY_STOPDATE)){
              if(formCriteria.getSortOrder().equalsIgnoreCase(AlertSearchCriteria.SORT_ORDER_DESC)){
                 searchCriteria.addOrder(Order.desc("expirationDate"));
                 log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): ORDER BY expirationDate; DESCENDING <<");
              }
              else{
                 searchCriteria.addOrder(Order.asc("expirationDate"));
               log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): ORDER BY expirationDate; ASCENDING <<");
              }
           }
           else if(formCriteria.getSortBy().equalsIgnoreCase(AlertSearchCriteria.SORTBY_TITLE)){
              if(formCriteria.getSortOrder().equalsIgnoreCase(AlertSearchCriteria.SORT_ORDER_DESC)){
                 searchCriteria.addOrder(Order.desc("title"));
                 log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): ORDER BY title; DESCENDING <<");
              }
              else{
                 searchCriteria.addOrder(Order.asc("title"));
               log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): ORDER BY title; ASCENDING <<");
              }
           }
           else{ //sort by alertId
              if(formCriteria.getSortOrder().equalsIgnoreCase(AlertSearchCriteria.SORT_ORDER_DESC)){
                 searchCriteria.addOrder(Order.desc("id"));
                 log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): ORDER BY id; DESCENDING <<");
              }
              else{
                 searchCriteria.addOrder(Order.asc("id"));
               log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): ORDER BY id; ASCENDING <<");
              }
           }

           log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): attempting to perform DB query <<");
         long startTimer = System.currentTimeMillis();
         alerts = searchCriteria.list();
           long stopTimer = System.currentTimeMillis();
         log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): ALERTS SUCCESSFULLY QUERIED - " + alerts.size() + " records returned in " + (stopTimer-startTimer) + " ms <<");
           }
          
       } catch (Exception e) {
          log.error(" ^^^ AlertDAOImpl.getAlertsByCriteria(): EXCEPTION CAUGHT - " + e.toString() + " ^^^", e);
           throw e;
       }

       log.debug(" >> AlertDAOImpl.getAlertsByCriteria(): returning new List of alerts <<");
       return new ArrayList(alerts);

   }


Full stack trace of any exception that occurs: No exception.

Name and version of the database you are using: mySQL 4.1.9

The generated SQL (show_sql=true):
Code:
select this.alert_id as alert_id0_, this.alert_title as alert_ti2_0_, this.alert_message as alert_me3_0_, this.alert_description as alert_de4_0_, this.alert_status as alert_st5_0_, this.alert_ae_msg_sent as alert_ae6_0_, this.alert_datetime_start as alert_da7_0_, this.alert_datetime_expire as alert_da8_0_, this.alert_followup_required as alert_fo9_0_, this.alert_followup_completed_datetime as alert_f10_0_, this.alert_mailinglist_filename as alert_m11_0_, this.alert_mailinglist_criteria as alert_m12_0_, this.alert_submitted_date as alert_s13_0_, this.alert_submitted_user as alert_s14_0_, this.alert_save_after_expire as alert_s15_0_, this.alert_lastmodified_user as alert_l16_0_ from ir_alerts this where not ((this.alert_status=? and this.alert_save_after_expire=?)) order by this.alert_id asc

select recipients0_.alert_id as alert_id__, recipients0_.alert_user_id as alert_us1___, recipients0_.alert_user_id as alert_us1_0_, recipients0_.user_id as user_id0_, recipients0_.alert_user_status as alert_us3_0_, recipients0_.alert_user_communication as alert_us4_0_, recipients0_.alert_user_comm_type as alert_us5_0_, recipients0_.alert_id as alert_id0_ from ir_alert_users recipients0_ where recipients0_.alert_id=?

Debug level Hibernate log excerpt:

DEBUG - >> AlertDAOImpl.getAlertsByCriteria(): getting criteria object (for Alert.class) from HibernateTemplate <<
DEBUG - Retrieved value [org.springframework.orm.hibernate.SessionHolder@18b3e62] for key [net.sf.hibernate.impl.SessionFactoryImpl@1c958af] bound to thread [http8072-Processor25]
DEBUG - Retrieved value [org.springframework.orm.hibernate.SessionHolder@18b3e62] for key [net.sf.hibernate.impl.SessionFactoryImpl@1c958af] bound to thread [http8072-Processor25]
DEBUG - >> AlertDAOImpl.getAlertsByCriteria(): got criteria object from HibernateTemplate; now setting criteria... <<
DEBUG - >> AlertDAOImpl.getAlertsByCriteria(): USERID = ALL <<
DEBUG - >> AlertDAOImpl.getAlertsByCriteria(): STATUS = ANY <<
DEBUG - >> AlertDAOImpl.getAlertsByCriteria(): ORDER BY id; ASCENDING <<
DEBUG - >> AlertDAOImpl.getAlertsByCriteria(): attempting to perform DB query <<
DEBUG - about to open: 0 open PreparedStatements, 0 open ResultSets
DEBUG - select this.alert_id as alert_id0_, this.alert_title as alert_ti2_0_, this.alert_message as alert_me3_0_, this.alert_description as alert_de4_0_, this.alert_status as alert_st5_0_, this.alert_ae_msg_sent as alert_ae6_0_, this.alert_datetime_start as alert_da7_0_, this.alert_datetime_expire as alert_da8_0_, this.alert_followup_required as alert_fo9_0_, this.alert_followup_completed_datetime as alert_f10_0_, this.alert_mailinglist_filename as alert_m11_0_, this.alert_mailinglist_criteria as alert_m12_0_, this.alert_submitted_date as alert_s13_0_, this.alert_submitted_user as alert_s14_0_, this.alert_save_after_expire as alert_s15_0_, this.alert_lastmodified_user as alert_l16_0_ from ir_alerts this where not ((this.alert_status=? and this.alert_save_after_expire=?)) order by this.alert_id asc
DEBUG - preparing statement
DEBUG - binding 'E' to parameter: 1
DEBUG - binding '0' to parameter: 2
DEBUG - processing result set
DEBUG - returning '1' as column: alert_id0_
DEBUG - result row: 1
DEBUG - Initializing object from ResultSet: 1
DEBUG - Hydrating entity: com.concordefs.starstation.alerts.Alert#1
DEBUG - returning 'Alert Title - Cancelled' as column: alert_ti2_0_
DEBUG - returning 'Generic Alert Message' as column: alert_me3_0_
DEBUG - returning 'This is a test cancelled alert.' as column: alert_de4_0_
DEBUG - returning 'C' as column: alert_st5_0_
DEBUG - returning '0' as column: alert_ae6_0_
DEBUG - returning '2005-03-24 00:00:00' as column: alert_da7_0_
DEBUG - returning '2005-04-02 00:00:00' as column: alert_da8_0_
DEBUG - returning '1' as column: alert_fo9_0_
DEBUG - returning null as column: alert_f10_0_
DEBUG - returning 'mailinglist.txt' as column: alert_m11_0_
DEBUG - returning '1' as column: alert_m12_0_
DEBUG - returning '2005-03-25 00:00:00' as column: alert_s13_0_
DEBUG - returning 'test.user' as column: alert_s14_0_
DEBUG - returning '1' as column: alert_s15_0_
DEBUG - returning 'test.user' as column: alert_l16_0_
DEBUG - returning '2' as column: alert_id0_
DEBUG - result row: 2
DEBUG - Initializing object from ResultSet: 2
DEBUG - Hydrating entity: com.concordefs.starstation.alerts.Alert#2
DEBUG - returning 'Title of Current Alert' as column: alert_ti2_0_
DEBUG - returning 'Generic Alert Message' as column: alert_me3_0_
DEBUG - returning 'This is a test current alert.' as column: alert_de4_0_
DEBUG - returning 'C' as column: alert_st5_0_
DEBUG - returning '1' as column: alert_ae6_0_
DEBUG - returning '2005-03-24 00:00:00' as column: alert_da7_0_
DEBUG - returning '2005-04-11 11:58:56' as column: alert_da8_0_
DEBUG - returning '1' as column: alert_fo9_0_
DEBUG - returning null as column: alert_f10_0_
DEBUG - returning 'mailinglist.txt' as column: alert_m11_0_
DEBUG - returning '1' as column: alert_m12_0_
DEBUG - returning '2005-03-17 00:00:00' as column: alert_s13_0_
DEBUG - returning 'test.user' as column: alert_s14_0_
DEBUG - returning '0' as column: alert_s15_0_
DEBUG - returning 'test.user' as column: alert_l16_0_
DEBUG - returning '3' as column: alert_id0_
...
DEBUG - result row: 70
DEBUG - Initializing object from ResultSet: 70
DEBUG - Hydrating entity: com.concordefs.starstation.alerts.Alert#70
DEBUG - returning 'KamalTest06' as column: alert_ti2_0_
DEBUG - returning 'KamalTest06' as column: alert_me3_0_
DEBUG - returning 'KamalTest06' as column: alert_de4_0_
DEBUG - returning 'C' as column: alert_st5_0_
DEBUG - returning '1' as column: alert_ae6_0_
DEBUG - returning '2005-04-12 09:30:00' as column: alert_da7_0_
DEBUG - returning '2005-04-12 11:13:39' as column: alert_da8_0_
DEBUG - returning '0' as column: alert_fo9_0_
DEBUG - returning null as column: alert_f10_0_
DEBUG - returning 'Kamal_Save_Alert.txt' as column: alert_m11_0_
DEBUG - returning '' as column: alert_m12_0_
DEBUG - returning '2005-04-12 11:12:00' as column: alert_s13_0_
DEBUG - returning 'EPSTEST1.KAMAL' as column: alert_s14_0_
DEBUG - returning '0' as column: alert_s15_0_
DEBUG - returning 'EPSTEST1.KAMAL' as column: alert_l16_0_
DEBUG - done processing result set (64 rows)
DEBUG - done closing: 0 open PreparedStatements, 0 open ResultSets
DEBUG - closing statement
DEBUG - total objects hydrated: 64
DEBUG - resolving associations for [com.concordefs.starstation.alerts.Alert#1]
DEBUG - creating collection wrapper:[com.concordefs.starstation.alerts.Alert.recipients#1]
DEBUG - initializing collection [com.concordefs.starstation.alerts.Alert.recipients#1]
DEBUG - checking second-level cache
DEBUG - collection not cached
DEBUG - about to open: 0 open PreparedStatements, 0 open ResultSets
DEBUG - select recipients0_.alert_id as alert_id__, recipients0_.alert_user_id as alert_us1___, recipients0_.alert_user_id as alert_us1_0_, recipients0_.user_id as user_id0_, recipients0_.alert_user_status as alert_us3_0_, recipients0_.alert_user_communication as alert_us4_0_, recipients0_.alert_user_comm_type as alert_us5_0_, recipients0_.alert_id as alert_id0_ from ir_alert_users recipients0_ where recipients0_.alert_id=?
DEBUG - preparing statement
DEBUG - binding '1' to parameter: 1
DEBUG - result set contains (possibly empty) collection: [com.concordefs.starstation.alerts.Alert.recipients#1]
DEBUG - uninitialized collection: initializing
DEBUG - processing result set
DEBUG - returning '1' as column: alert_us1_0_
DEBUG - result row: 1
DEBUG - Initializing object from ResultSet: 1
DEBUG - Hydrating entity: com.concordefs.starstation.alerts.AlertRecipient#1
DEBUG - returning 'EPSTEST1.CECI3' as column: user_id0_
DEBUG - returning 'N' as column: alert_us3_0_
DEBUG - returning 'mceci@concordefs.com' as column: alert_us4_0_
DEBUG - returning 'E' as column: alert_us5_0_
DEBUG - returning '1' as column: alert_id0_
DEBUG - returning '1' as column: alert_id__
DEBUG - found row of collection: [com.concordefs.starstation.alerts.Alert.recipients#1]
DEBUG - reading row
DEBUG - returning '1' as column: alert_us1___
DEBUG - loading [com.concordefs.starstation.alerts.AlertRecipient#1]
DEBUG - attempting to resolve [com.concordefs.starstation.alerts.AlertRecipient#1]
DEBUG - resolved object in session cache [com.concordefs.starstation.alerts.AlertRecipient#1]
DEBUG - done processing result set (1 rows)
DEBUG - done closing: 0 open PreparedStatements, 0 open ResultSets
DEBUG - closing statement
DEBUG - total objects hydrated: 1
DEBUG - resolving associations for [com.concordefs.starstation.alerts.AlertRecipient#1]
DEBUG - loading [com.concordefs.starstation.alerts.Alert#1]
DEBUG - attempting to resolve [com.concordefs.starstation.alerts.Alert#1]
DEBUG - resolved object in session cache [com.concordefs.starstation.alerts.Alert#1]
DEBUG - done materializing entity [com.concordefs.starstation.alerts.AlertRecipient#1]
DEBUG - 1 collections were found in result set
DEBUG - collection fully initialized: [com.concordefs.starstation.alerts.Alert.recipients#1]
DEBUG - 1 collections initialized
DEBUG - collection initialized
DEBUG - done materializing entity [com.concordefs.starstation.alerts.Alert#1]
DEBUG - resolving associations for [com.concordefs.starstation.alerts.Alert#2]
DEBUG - creating collection wrapper:[com.concordefs.starstation.alerts.Alert.recipients#2]
DEBUG - initializing collection [com.concordefs.starstation.alerts.Alert.recipients#2]
DEBUG - checking second-level cache
DEBUG - collection not cached
DEBUG - about to open: 0 open PreparedStatements, 0 open ResultSets
DEBUG - select recipients0_.alert_id as alert_id__, recipients0_.alert_user_id as alert_us1___, recipients0_.alert_user_id as alert_us1_0_, recipients0_.user_id as user_id0_, recipients0_.alert_user_status as alert_us3_0_, recipients0_.alert_user_communication as alert_us4_0_, recipients0_.alert_user_comm_type as alert_us5_0_, recipients0_.alert_id as alert_id0_ from ir_alert_users recipients0_ where recipients0_.alert_id=?
DEBUG - preparing statement
DEBUG - binding '2' to parameter: 1
DEBUG - result set contains (possibly empty) collection: [com.concordefs.starstation.alerts.Alert.recipients#2]
DEBUG - uninitialized collection: initializing
DEBUG - processing result set
DEBUG - returning '2' as column: alert_us1_0_
DEBUG - result row: 2
DEBUG - Initializing object from ResultSet: 2
DEBUG - Hydrating entity: com.concordefs.starstation.alerts.AlertRecipient#2
DEBUG - returning 'EPSTEST1.MAJORSC' as column: user_id0_
DEBUG - returning 'K' as column: alert_us3_0_
DEBUG - returning '302-791-8707' as column: alert_us4_0_
DEBUG - returning 'F' as column: alert_us5_0_
DEBUG - returning '2' as column: alert_id0_
DEBUG - returning '2' as column: alert_id__
DEBUG - found row of collection: [com.concordefs.starstation.alerts.Alert.recipients#2]
DEBUG - reading row
DEBUG - returning '2' as column: alert_us1___
DEBUG - loading [com.concordefs.starstation.alerts.AlertRecipient#2]
DEBUG - attempting to resolve [com.concordefs.starstation.alerts.AlertRecipient#2]
DEBUG - resolved object in session cache [com.concordefs.starstation.alerts.AlertRecipient#2]
DEBUG - returning '3' as column: alert_us1_0_
DEBUG - result row: 3
DEBUG - Initializing object from ResultSet: 3
DEBUG - Hydrating entity: com.concordefs.starstation.alerts.AlertRecipient#3
DEBUG - returning 'EPSTEST1.IRWIN' as column: user_id0_
DEBUG - returning 'N' as column: alert_us3_0_
DEBUG - returning 'dirwin@concordefs.com' as column: alert_us4_0_
DEBUG - returning 'E' as column: alert_us5_0_
DEBUG - returning '2' as column: alert_id0_
DEBUG - returning '2' as column: alert_id__
DEBUG - found row of collection: [com.concordefs.starstation.alerts.Alert.recipients#2]
DEBUG - reading row
DEBUG - returning '3' as column: alert_us1___
DEBUG - loading [com.concordefs.starstation.alerts.AlertRecipient#3]
DEBUG - attempting to resolve [com.concordefs.starstation.alerts.AlertRecipient#3]
DEBUG - resolved object in session cache [com.concordefs.starstation.alerts.AlertRecipient#3]
DEBUG - returning '4' as column: alert_us1_0_
DEBUG - result row: 4
DEBUG - Initializing object from ResultSet: 4
DEBUG - Hydrating entity: com.concordefs.starstation.alerts.AlertRecipient#4
DEBUG - returning 'TESTUSER' as column: user_id0_
DEBUG - returning 'K' as column: alert_us3_0_
DEBUG - returning 'mceci@concordefs.com' as column: alert_us4_0_
DEBUG - returning 'E' as column: alert_us5_0_
DEBUG - returning '2' as column: alert_id0_
DEBUG - returning '2' as column: alert_id__
DEBUG - found row of collection: [com.concordefs.starstation.alerts.Alert.recipients#2]
DEBUG - reading row
DEBUG - returning '4' as column: alert_us1___
DEBUG - loading [com.concordefs.starstation.alerts.AlertRecipient#4]
DEBUG - attempting to resolve [com.concordefs.starstation.alerts.AlertRecipient#4]
DEBUG - resolved object in session cache [com.concordefs.starstation.alerts.AlertRecipient#4]
DEBUG - returning '5' as column: alert_us1_0_
DEBUG - result row: 5
DEBUG - Initializing object from ResultSet: 5
DEBUG - Hydrating entity: com.concordefs.starstation.alerts.AlertRecipient#5
DEBUG - returning 'EPSTEST1.KAMAL' as column: user_id0_
DEBUG - returning 'K' as column: alert_us3_0_
DEBUG - returning 'kitigi@concordefs.com' as column: alert_us4_0_
DEBUG - returning 'E' as column: alert_us5_0_
DEBUG - returning '2' as column: alert_id0_
DEBUG - returning '2' as column: alert_id__
DEBUG - found row of collection: [com.concordefs.starstation.alerts.Alert.recipients#2]
DEBUG - reading row
DEBUG - returning '5' as column: alert_us1___
DEBUG - loading [com.concordefs.starstation.alerts.AlertRecipient#5]
DEBUG - attempting to resolve [com.concordefs.starstation.alerts.AlertRecipient#5]
DEBUG - resolved object in session cache [com.concordefs.starstation.alerts.AlertRecipient#5]
DEBUG - returning '6' as column: alert_us1_0_
...


Top
 Profile  
 
 Post subject: SOLUTION
PostPosted: Thu Apr 14, 2005 11:53 am 
Newbie

Joined: Mon Feb 14, 2005 10:59 am
Posts: 3
Location: Wilmington, DE
I found that there were two causes of this issue:

(1) Debug mode (in log4j) seems to load in all child records (i.e., "AlertRecipients"). Info mode does not.
(2) The process of returning the list to a client through a Hessian remote call also seems to load the child records.

SOLUTION: Since the child records were not actually needed for these queries (which is why I set lazy=true), I simply set the value of the child Set to null before returning the list to the client via Hessian.


Top
 Profile  
 
 Post subject: Too obvious
PostPosted: Mon Nov 21, 2005 6:41 pm 
Newbie

Joined: Mon Nov 21, 2005 6:39 pm
Posts: 1
Well of course that was what the problem was, I saw it as soon as I looked at your code. What kind of programer are you anyway that you didn't catch that???

Luv and Kisses
Nana


Top
 Profile  
 
 Post subject: Re: Too obvious
PostPosted: Mon Nov 21, 2005 10:58 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
inbasement wrote:
Well of course that was what the problem was, I saw it as soon as I looked at your code. What kind of programer are you anyway that you didn't catch that???


quit this.


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