RE: [Objectbridge-developers] Object References
Brought to you by:
thma
From: Bischof, R. <rai...@ed...> - 2001-09-24 14:10:25
|
Thomas, I strongly support this request although its too late for our project = ;-( This manual coding introduces a new point of failure where simple typos = can cause you hours to identify: You have a persistent object with = references that looses it's references when re-loaded from the DB. The first thing = you do is check your mapping file but you will probably not check the = setter methods for the ID and reference IDs.=20 Thanks Rainer Bischof > -----Original Message----- > From: Mahler Thomas [mailto:tho...@it...] > Sent: Montag, 24. September 2001 15:48 > To: 'Charles Anthony' > Cc: Objectbridge (E-Mail); Tom (E-Mail) > Subject: AW: [Objectbridge-developers] Object References >=20 >=20 > Hi Anthony, >=20 > > -----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 >=20 > OJB is clever, but not that clever yet ;-) >=20 > > "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=20 > hide this from > the application developer. But I agree that it would be a=20 > good feature to > have OJB handle this stuff automatically. >=20 > I will place this as a new feature request on my todo list! >=20 > --Thomas >=20 >=20 > >=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 >=20 > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers >=20 |