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

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Unable to lazily load <one-to-one> with <formula>
PostPosted: Fri Apr 04, 2008 1:21 pm 
Newbie

Joined: Mon Jan 23, 2006 12:37 pm
Posts: 16
Hibernate version: 3.2.5 GA

Name and version of the database you are using: MS SQL Server 2005

Mapping documents:

Code:
    <class name="Company" table="prolog.dbo.Company" >

       <id name="companyId" column="CompanyID" type="com.shawmut.util.hibernate.type.ConvertToUpperCaseStringType" unsaved-value="null">
            <generator class="com.shawmut.util.hibernate.id.CompanyIndentifierGenerator">
                      <param name="storedProcedure">{ call dbo.hbm_Company_NewKey(?) }</param>                      
            </generator>
        </id>


        <one-to-one name="mainAddress" property-ref="mainCompanyAddress" constrained="true" cascade="none"  outer-join="false" >
          <formula>1</formula>
          <formula>CompanyID</formula>
       </one-to-one>

    </class>

    <class name="Address" table="prolog.dbo.Addresses">
   
        <id name="addressId" column="AddressID">
            <generator class="com.shawmut.util.hibernate.id.MaxPlusOneIdentifierGenerator"/>
        </id>

      <properties name="mainCompanyAddress" unique="true">
           <property name="mainAddress" column="IsMainAddress" not-null="true"/>
           <property name="companyId" column="CompanyID" type="com.shawmut.util.hibernate.type.ConvertToUpperCaseStringType" not-null="true"/>           
       </properties>

   </class>


I've searched and searched and i'm posting as a last resort at resolving a problem that i have. I have a Company object that has many Addresses, one of those addresses is the main address. So i have:

someCompany.getMainAddress()


I can not get this association to load lazily. As you can see i have the constrained="true" and outer-join="false" attributes properly set on the one-to-one as suggested here: http://www.hibernate.org/162.html.

What makes this association unique is that i'm using two formula tags to achieve this and I believe this is why i'm having this issue. I have also tried using a many-to-one but to no avail as well.


I would like to submit to a patch if this is not supported yet by hibernate. Can someone point me in the right direction in the code base where i can begin to investigate on how to fix this?

Regards,
Russ


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

All times are UTC - 5 hours [ DST ]


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

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