-->
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: batch loading a property with a property-ref and a formula
PostPosted: Tue Jun 19, 2007 4:36 pm 
Newbie

Joined: Fri Oct 27, 2006 11:39 am
Posts: 10
Hibernate version: 3.1.3

Mapping documents:
Code:
<class
        name="ContactImpl"
        table="CONTACT"
    >
        <many-to-one name="primaryTitle" property-def="primaryContactTitle"
        class="ContactTitleImpl"
            cascade="all"
            fetch="select"
            unique="true"
            insert="false"
            update="false"
            not-null="true">
           <formula>1</formula>
           <formula>CONTACT_ID</formula>
        </many-to-one>   
</class>

    <class
        name="ContactTitleImpl"
        table="CONTACT_TITLE"
        batch-size="100"
    >
        <properties name="primaryContactTitle">
           <property name="primary" column="primary_title"/>
           <many-to-one name="contact"
           class="ContactImpl"
           column="contact_id"/>
          </properties>

</class>


Given the mapping above, I would like the load a bunch of contacts, then batch-load their primary titles. I can get it to work with simple many-to-one properties, but can't get it to work with a many-to-one where there is a formula and a property-ref involved.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 20, 2007 6:37 am 
Newbie

Joined: Fri Oct 27, 2006 11:39 am
Posts: 10
I believe it has something to do with the following, which appears that the property-ref is the uniqueKeyPropertyName for the EmbeddedComponentType.... Is this accurate? If so, does that mean that EmbeddedComponentTypes can't be batch-loaded?

Code:

ManyToOneType.java

   private void scheduleBatchLoad(Serializable id, SessionImplementor session)
   throws MappingException {
      
      if (uniqueKeyPropertyName==null) { //cannot batch fetch by unique key
      
         EntityPersister persister = session.getFactory()
               .getEntityPersister( getAssociatedEntityName() );
         
         EntityKey entityKey = new EntityKey( id, persister, session.getEntityMode() );
         session.getPersistenceContext()
               .getBatchFetchQueue()
               .addBatchLoadableEntityKey( entityKey );
      }
   }


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 20, 2007 9:35 am 
Regular
Regular

Joined: Mon Mar 26, 2007 12:38 am
Posts: 119
Hi,
There is a bug reported on this issue. ( in open state )
http://opensource.atlassian.com/project ... e/HHH-2624


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.