Stephane Le Dorze <
stephane...@gmail.com> writes:
> I know that all fenix relations are bidirectional; hovewer I wonder if
> there could be some relaxation for unidirectional relations so that
> the common objects would not suffer of becoming blobesque entities
> (with a number of relations that is proportional to the number
> of activities)
Actually, you may have unidirectional relations in the fenix-framework.
You get them by not giving a name to a role.
For instance, using an example suggested by your domain, you may have
something along these lines:
// In the bottom layer
class User;
// In the upper layer
class MyActivity;
relation MyActivityUser {
User playsRole user;
MyActivity playsRole { multiplicity 0..*; }
}
This way, you will be able to traverse from the MyActivity to the User
(via the "user" role), but not the other way around.
Another alternative is if you want to compile things separately.
Imagine that you have your lower layer with its DML code and you compile it.
Then you want to compile the upper layer (or part of it, such as a new
activity) but still relate to the entities in the lower layer. In this
case, you will have a DML for the upper layer (or activity) where you
refer to the lower layer entities as external entities. For instance:
// These external entities come from the lower layer
external class User;
Then, you may have relations between your new entities and these
external entities that they will not change the external entities:
relation MyActivityUser {
User playsRole user;
MyActivity playsRole activities { multiplicity 0..*; }
}
This last option is not as well exercised as the one above and there may
be still some problems with it. Namely, because with the current
mapping scheme, we may have to change the database schema of an external
entity and I'm not sure if that is working (or how it should be done).
Was something along these lines what you were looking for?
Best regards,
--
João Cachopo