DDD, ERD, ORM: has one, or belongs to one?

Airwolfy

New Member
I was wondering if there was such thing as 'belongs to' relationship, and what was its function, or if it was just the opposite to 'has one'?The question arised when building an ORM, and wanted to find a way to determine when a entity instance should be automatically deleted, eg:User 'has many' ThreadThread 'has many' CommentThread 'has one' UserComment 'has one' ThreadSuppose you delete a user instance. Its related thread instances should remain intact.But if you delete a thread instance, its comments should be deleted.With the above schema, the ORM can't tell when to delete and when not to.But if I use 'belong to', it could be a solution:User 'has many' ThreadThread 'has many' CommentThread 'has one' UserComment 'belongs to one' ThreadDoes this make sense? It is possible for the ORM, but does ERD cover this scenario? The one-to-one/one-to-many connections don't seem to be enough.Any thoughts?
 
Back
Top