-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: caching composite-element collection
PostPosted: Wed Feb 04, 2004 3:33 pm 
Beginner
Beginner

Joined: Tue Aug 26, 2003 6:24 pm
Posts: 45
Hi All -
I have a Set collection mapped with a composite-element.

I'm using spring, and after each session.load(), the session is flushed.

With this collection, during the flush the collection is deemed dirty, which causes a chain reaction of updates and cache invalidations that I don't want.

Any suggestions on what is making this collection be interpreted as dirty on every load?

the mapping for this set looks like:
Code:
       <set
            name="invitationAddlContacts"
            table="INVITATION_ADDL_CONTACT"
            lazy="false"
            inverse="true"
            cascade="all"
            sort="unsorted"
        >
            <cache
                usage="nonstrict-read-write"
             />

              <key
                  column="INVITATION_ID"
              />

              <composite-element
                  class="com.benefitpoint.cmp.marketing.invitation.InvitationAddlContact"
              >
        <property
            name="email"
            type="java.lang.String"
            update="true"
            insert="true"
            column="EMAIL_ADDR"
        />

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

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

              </composite-element>

        </set>


my hibernate log looks like:
Code:
DEBUG|11:25:00.837|net.sf.hibernate.impl.BatcherImpl|prepared statement get: select invitati0_.EMAIL_ADDR as EMAIL_ADDR_
_, invitati0_.FIRST_NAME as FIRST_NAME__, invitati0_.LAST_NAME as LAST_NAME__, invitati0_.INVITATION_ID as INVITATI1___
from INVITATION_ADDL_CONTACT invitati0_ where invitati0_.INVITATION_ID=?
DEBUG|11:25:00.837|net.sf.hibernate.impl.BatcherImpl|preparing statement
DEBUG|11:25:00.837|net.sf.hibernate.type.IntegerType|binding '22' to parameter: 1
DEBUG|11:25:00.837|net.sf.hibernate.loader.Loader|result set contains (possibly empty) collection: [com.benefitpoint.cmp
.marketing.invitation.Invitation.invitationAddlContacts#22]
DEBUG|11:25:00.837|net.sf.hibernate.impl.SessionImpl|uninitialized collection: initializing
DEBUG|11:25:00.837|net.sf.hibernate.loader.Loader|processing result set
DEBUG|11:25:00.837|net.sf.hibernate.loader.Loader|result row:
DEBUG|11:25:00.837|net.sf.hibernate.type.IntegerType|returning '22' as column: INVITATI1___
DEBUG|11:25:00.837|net.sf.hibernate.loader.Loader|found row of collection: [com.benefitpoint.cmp.marketing.invitation.In
vitation.invitationAddlContacts#22]
DEBUG|11:25:00.837|net.sf.hibernate.impl.SessionImpl|reading row
DEBUG|11:25:00.837|net.sf.hibernate.type.StringType|returning 'email1' as column: EMAIL_ADDR__
DEBUG|11:25:00.837|net.sf.hibernate.type.StringType|returning 'firstname1' as column: FIRST_NAME__
DEBUG|11:25:00.837|net.sf.hibernate.type.StringType|returning 'lastname1' as column: LAST_NAME__
DEBUG|11:25:00.837|net.sf.hibernate.loader.Loader|result row:
DEBUG|11:25:00.837|net.sf.hibernate.type.IntegerType|returning '22' as column: INVITATI1___
DEBUG|11:25:00.837|net.sf.hibernate.loader.Loader|found row of collection: [com.benefitpoint.cmp.marketing.invitation.In
vitation.invitationAddlContacts#22]
DEBUG|11:25:00.837|net.sf.hibernate.impl.SessionImpl|reading row
DEBUG|11:25:00.837|net.sf.hibernate.type.StringType|returning 'email2' as column: EMAIL_ADDR__
DEBUG|11:25:00.852|net.sf.hibernate.type.StringType|returning 'firstname2' as column: FIRST_NAME__
DEBUG|11:25:00.852|net.sf.hibernate.type.StringType|returning 'lastname2' as column: LAST_NAME__
DEBUG|11:25:00.852|net.sf.hibernate.loader.Loader|done processing result set (2 rows)
DEBUG|11:25:00.852|net.sf.hibernate.impl.BatcherImpl|done closing: 0 open PreparedStatements, 0 open ResultSets
DEBUG|11:25:00.852|net.sf.hibernate.impl.BatcherImpl|closing statement
DEBUG|11:25:00.852|net.sf.hibernate.impl.SessionImpl|1 collections were found in result set
DEBUG|11:25:00.852|net.sf.hibernate.impl.SessionImpl|Caching collection: [com.benefitpoint.cmp.marketing.invitation.Invi
tation.invitationAddlContacts#22]
DEBUG|11:25:00.852|net.sf.hibernate.cache.ReadWriteCache|Updating: 22
DEBUG|11:25:00.852|net.sf.hibernate.impl.SessionImpl|collection fully initialized: [com.benefitpoint.cmp.marketing.invit
ation.Invitation.invitationAddlContacts#22]
DEBUG|11:25:00.852|net.sf.hibernate.impl.SessionImpl|1 collections initialized
DEBUG|11:25:00.852|org.springframework.transaction.support.TransactionSynchronizationManager|Triggering beforeCommit syn
chronization
DEBUG|11:25:00.852|org.springframework.orm.hibernate.SessionFactoryUtils|Flushing Hibernate session on transaction synch
ronization
DEBUG|11:25:00.852|net.sf.hibernate.impl.SessionImpl|flushing session
DEBUG|11:25:00.852|net.sf.hibernate.engine.Cascades|processing cascades for: com.benefitpoint.cmp.marketing.invitation.I
nvitation
DEBUG|11:25:00.852|net.sf.hibernate.engine.Cascades|cascading to collection: com.benefitpoint.cmp.marketing.invitation.I
nvitation.invitationAddlContacts
DEBUG|11:25:00.852|net.sf.hibernate.engine.Cascades|done processing cascades for: com.benefitpoint.cmp.marketing.invitat
ion.Invitation
DEBUG|11:25:00.852|net.sf.hibernate.impl.SessionImpl|Collection dirty: [com.benefitpoint.cmp.marketing.invitation.Invita
tion.invitationAddlContacts#22]
DEBUG|11:25:00.852|net.sf.hibernate.impl.SessionImpl|Flushing entities and processing referenced collections
DEBUG|11:25:00.852|net.sf.hibernate.impl.SessionImpl|Updating entity: [com.benefitpoint.cmp.marketing.invitation.Invitat
ion#22]
DEBUG|11:25:00.852|net.sf.hibernate.engine.Versioning|Incrementing: 197 to 198


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

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Quote:
Any suggestions on what is making this collection be interpreted as dirty on every load?


Bad equals/hashCode implementation?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2004 4:07 pm 
Beginner
Beginner

Joined: Tue Aug 26, 2003 6:24 pm
Posts: 45
bingo

thanks gavin!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.