[Objectbridge-developers] Object References
Brought to you by:
thma
From: Charles A. <cha...@hp...> - 2001-09-24 10:14:02
|
Hi, I have an Agreement object and an AgreementType object. Agreement has a reference to Agreement type. In the database, the field agreementType_id (mapped to agreementTypeId) cannot be null i.e. an agreement must have an agreement type. public class Agreement { private BigDecimal id; private BigDecimal agreementTypeId; private AgreementType agreementType; I have accessor methods (get+set) for id and agreementType, but not for agreementTypeId - I don't really want the developer to have to set this exlicitly, unless absolutely necessary. I instantiated a new Agreement, set the id and the agreementType fields to be valid objects, I expected OJB to be smart and populate the agreementTypeId for me from the agreementType reference. It didn't, hence I got a SQL error "Cannot insert the value NULL into column 'AgreementType_ID', table 'AccountingProto.dbo.Agreement'; column does not allow nulls. INSERT fails." Can/does OJB do this for me, or do I have to set the agreementTypeId myself ? This email and any attachments are strictly confidential and are intended solely for the addressee. If you are not the intended recipient you must not disclose, forward, copy or take any action in reliance on this message or its attachments. If you have received this email in error please notify the sender as soon as possible and delete it from your computer systems. Any views or opinions presented are solely those of the author and do not necessarily reflect those of HPD Software Limited or its affiliates. At present the integrity of email across the internet cannot be guaranteed and messages sent via this medium are potentially at risk. All liability is excluded to the extent permitted by law for any claims arising as a re- sult of the use of this medium to transmit information by or to HPD Software Limited or its affiliates. |