AW: [Objectbridge-developers] Object References
Brought to you by:
thma
From: Mahler T. <tho...@it...> - 2001-09-24 13:48:45
|
Hi Anthony, > -----Urspr=FCngliche Nachricht----- > Von: Charles Anthony [mailto:cha...@hp...] > Gesendet: Montag, 24. September 2001 12:11 > An: 'obj...@li...' > Betreff: [Objectbridge-developers] Object References >=20 >=20 > Hi, >=20 > I have an Agreement object and an AgreementType object. > Agreement has a reference to Agreement type. >=20 > In the database, the field agreementType_id (mapped to=20 > agreementTypeId) > cannot be null i.e. an agreement must have an agreement type. >=20 > public class Agreement { >=20 > private BigDecimal id; > private BigDecimal agreementTypeId; > private AgreementType agreementType; >=20 > I have accessor methods (get+set) for id and agreementType,=20 > but not for > agreementTypeId - I don't really want the developer to have=20 > to set this > exlicitly, unless absolutely necessary. >=20 > I instantiated a new Agreement, set the id and the=20 > agreementType fields to > be valid objects, I expected OJB to be smart and populate the > agreementTypeId for me from the agreementType reference. It=20 > didn't, hence I > got a SQL error=20 >=20 OJB is clever, but not that clever yet ;-) > "Cannot insert the value NULL into column 'AgreementType_ID', table > 'AccountingProto.dbo.Agreement'; column does not allow nulls.=20 > INSERT fails." >=20 > Can/does OJB do this for me, or do I have to set the=20 > agreementTypeId myself > ? >=20 As of today OJB does NOT handle this automatically: you have to fill foreignkey attributes in your client app. Of course you can hide this = from the application developer. But I agree that it would be a good feature = to have OJB handle this stuff automatically. I will place this as a new feature request on my todo list! --Thomas >=20 > This email and any attachments are strictly confidential and=20 > are intended > solely for the addressee. If you are not the intended=20 > recipient you must > not disclose, forward, copy or take any action in reliance on=20 > this message > or its attachments. If you have received this email in error=20 > please notify > the sender as soon as possible and delete it from your=20 > computer systems. > Any views or opinions presented are solely those of the=20 > author and do not > necessarily reflect those of HPD Software Limited or its affiliates. >=20 > At present the integrity of email across the internet cannot=20 > be guaranteed > and messages sent via this medium are potentially at risk. =20 > All liability > is excluded to the extent permitted by law for any claims=20 > arising as a re- > sult of the use of this medium to transmit information by or to=20 > HPD Software Limited or its affiliates. >=20 >=20 >=20 > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers >=20 |