Page 1 of 1
Foreign Key
Posted: Fri Aug 07, 2009 11:35 am
by ConvertFromOldNGs
by jimmy >> Fri, 1 Aug 2008 8:40:12 GMT
Dear Jade
Halo
I have a question about design Object as foreign key in Jade.
comparing to RDBMS, we have primary and foreign key as constrain to
each table.
then how do I make foreign key to constrain to primary key from other super class ?
note :
I already try "add reference" and "define Inverse" and the result ... there is no constrain data from the reference object class
thanks a lot
Jimmy
Re: Foreign Key
Posted: Fri Aug 07, 2009 11:35 am
by ConvertFromOldNGs
by Patwos >> Fri, 8 Aug 2008 4:26:14 GMT
If you mean, for example, that you want a collection of say Customers keyed by the customer's Sales Representative, then you achieve that in Jade by creating a dictionary with a key of Customer::mySalesRep.
If you wanted to key by an attribute of the sales rep, say their employee number, then you could have a dictionary key something like Customer::mySalesRep::employeeID.
If I have mis-interpreted your question, could you please expand with an example of what you are trying to achieve.
Hope that helps,
Pat.
Re: Foreign Key
Posted: Fri Aug 07, 2009 11:35 am
by ConvertFromOldNGs
by jimmy >> Sat, 16 Aug 2008 7:27:19 GMT
Hallo Patwos
You get what I mean but I still confuse if the case like bellow
How do I make a constrains for class person
example
class Person ( ID, *Name, Address, **Department)
class Project (NameProject, *Participants, Time)
class Office (NameOffice, **Department))
note
* and ** means constrains
thx
jimmy
Re: Foreign Key
Posted: Fri Aug 07, 2009 11:35 am
by ConvertFromOldNGs
by Patwos >> Wed, 20 Aug 2008 6:51:27 GMT
I decided a small sample schema may be easier to understand than words. The attached schema shows the following:
All Persons ordered by Name
All Persons ordered by ID
All Persons ordered by their Department's name
All High Paid Persons - restricted by a constraint on the inverse
Only persons for a selected department - restricted by collection location
This shows how to use a standard key (two examples), a foreign key, how to constrain the entries in a collection based on an attribute on the member object for the collection (salary > $50,000) and also how you would constrain the collection to only those for a given department by way of the collection being on the department object in question and inversed to the myDepartment reference on the person object?
Hope that helps,
Pat.