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