Hi
I hv 2 tables
Code:
Partner and Profile
PK: partner_ID -------\ PK:profile_ID
... other cols.. \.---> FK:partner_ID (ref. Partner table)
... other cols...
The association between the table as seen is ONE-to-ONE
My hydrated objects are as:
Code:
/**
* @hibernate.class table="PARTNER"
*/
public class Partner {
Integer partnerID;
Profile profile;
/**
* @hibernate.id generator-class="native" type="long" column="PARTNER_ID"
*/
public void getPartnerID() {
return partnerID
}
/**
* @hibernate.one-to-one name="profile" constrained="true" class="Profile"
* cascade="all" outer-join="true" property-ref="partnerId"
*/
public void getProfile() {
return profile
}
}
and
Code:
/**
* @hibernate.class table="PROFILE"
*/
public class Profile {
Integer profileID;
Integer partnerID; //FK
/**
* @hibernate.id generator-class="native" type="long" column="PROFILE_ID"
*/
public void getProfileID() {
return profileID;
}
/**
* @hibernate.property column="PARTNER_ID" length="9"
*/
public void getPartnerID() {
return partnerID
}
}
In a test code I do, a
partner = Partner.findByPartnerCode("FMW"); //this method exists but is not shown above
Profile sp = partner.getProfile();
but I get an exception
No row with the given identifier exists: 858, of class: <packagename>.Profile
But in database values do exist.
I cannot figure out why?
I feel the hibernate Xdoclet I hv for one-to-one is not correct, but what is wrong is the mystery.
Any clues ?