cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hans C. Poo" <>
Subject Re: Mapping Question
Date Tue, 12 Apr 2011 20:14:47 GMT

I had a similar problem and solved it making the relationship in the reverse sense of what
composition dictates.

First create NoteCollection that contains a Collection of Notes.

Entities, Think Topic, Project, Category, Asset must have an "id_note_collection" field. 


Project --> NoteCollection --> * Note
Asset --> NoteCollection --> * Note

Any Entity that needs a NoteCollection must have an noteCollectionId.


----- Mensaje original -----
De: "Tony Giaccone" <>
Enviados: Martes, 12 de Abril 2011 16:43:49
Asunto: Mapping Question

This is more of a generic question, though I'm interested in how it might be
implemented in Cayenne as well.

I have a number of entities, Think Topic, Project, Category, Asset.  On each
one I need to model a to many relationship to Notes, Where a Note is an
object with a subject and a date created and content.

I"m not sure what the best strategy is to map each of these different
entities. I really don't want to create 4 note tables, So that there's a
Topic Note table, and a Project  Note table and  well you get the idea.

I could put a discriminator on the table, so that each entry has it's own
"type" that would solve part of the problem, but they I have to create the
foreign keys relationship.

So I'm just looking for some advice. Have you dealt with a similar
situation, and how did you model in general this solution and in Cayenne in

Thanks for the help

Tony Giaccone

View raw message