메일링 리스트 webobjects-dev@wocommunity.org 메시지 #485
보낸 사람: Markus Ruggiero (rucotec) <markus.ruggiero@rucotec.ch>
제목: Ideas for arbitrary to-one associations
일자: Mon, 15 Jan 2024 13:45:45 +0100
받는 사람: WebObjects & WOnder Development <webobjects-dev@wocommunity.org>
서명된 데이터 (Text SHA256)
I am looking for ideas / strategies to implement the following requirement:

I want to implement something I call GeneralNote. It should be possible to create such a note anywhere in the application and associate it with the current EO, whatever this may be. Thus any EO can potentially have 0 to many GeneralNote objects hanging off it. One GeneralNote however is not shared, thus it is a real to-one relationship from GeneralNote to an EO.
It is obviously not possible (well, more like totally impractical) to model a to-one relationship from GeneralNote to any/all possible destination entities in my EOModel.

Any ideas on how to do this? I want to leverage as much as possible the power of EOF. I was experimenting with code that puts the destination entity and the destination object’s primary key value in attributes of GeneralNote. I also have code that can find GlobalNote objects for an EO by using its entity name and primary key for fetching. All our EOs share a common base class that can easily accommodate such code generically. But what if the EO and a note is created at the same time? There is no primary key value yet! And how can I prevent an EO from being deleted and leaving orphaned notes behind? Would overriding willDelete() be a good place to also delete the notes? What about not allowing EO deletion when there still are notes?

Thanks for any ideas!
---markus---

내용 변경이 없음이 보증됨:
<markus.ruggiero@rucotec.ch>
가입 (FEED) 가입 (DIGEST) 가입 (INDEX) 탈퇴 Listmaster에게 메일 보내기