User's Manual

Chapter 9. Persistence Tutorial 93
String[1..1] name = groups.name;
// ...
}
object type User {
BigInteger[1..1] id = users.user_id;
String[1..1] name = users.name;
String[1..1] email = users.email;
// ...
}
association {
Group[0..n] groups = join users.user_id to \
group_member_map.member_id,
join group_member_map.group_id to \
groups.group_id;
User[0..n] members = join groups.group_id to \
group_member_map.group_id,
join group_member_map.member_id to \
users.user_id;
Date[1..1] membershipDate = group_member_map.membership_date;
}
Note
In this case, all events are auto-generated and will only work if the link attribute (in this case, mem-
bershipDate) is defined within the mapping table. If the DDL generator is used, the above association
definition will create the correct mapping table.
It is also possible to have a link attribute that returns a full object type (e.g. another User) rather than
a simple object type (e.g. a Date). Everything in this example is the same if you replace Date with
User. The only extra assumption made is that the full object type (e.g. User) only has a single Object
Key and that key is the item stored in the mapping table (e.g. user_id must be stored in the mapping
table in the case of User).
9.8.2. Link Attributes API
Once the PDL has been written to describe link attributes, the java API may access the values using
the following methods (remove the "\" and make it all one line):
DataObject DataAssociation.add(DataObject object)
http://rhea.redhat.com/doc/waf/6.0/api/com/arsdigita/persistence/\
DataAssociation.html#add(com.arsdigita.persistence.DataObject)
Object DataAssociationCursor.getLinkProperty(java.lang.String)
http://rhea.redhat.com/doc/waf/6.0/api/com/arsdigita/persistence/\
DataAssociationCursor.html#getLinkProperty(java.lang.String)
classname http://rhea.redhat.com/doc/waf/6.0/api/com/arsdigita/persistence/\
DataAssociationCursor.html#getLink()