Hi,
I am working with a demo version of CocoBase and followed some of the examples in the tutorials.
I manually created a Customer table and an Employee table. In the Employee table, I created a foreign key that refers back to the Customer table, establishing a 1-M relationship between an Employee and the Customers they had served.
I generated a map of both tables and then automatically generated the Java code using CocoAdmin. [Regular Java objects, not EJB's] CocoAdmin was automatically aware of the foreign key relationship, and generated code in the Employee object that allowed retrieval of relevant Customer objects.
So I tried to use the Employee class to retrieve a list of related Customers. [Employee.getCustomers ()] However, only Customer data/rows that were inserted using the Employee class were retrieved/visible. [i.e. Employee.setCustomer (aCustomer)]. But the Customer data I entered manually in the Customer table were not retrieved/visible. [insert into Customer values ('XXX', 'YYY', etc). I made sure to enter a foreign key that points back to a valid Employee tuple in the Employee table.]
Is this normal behavior? Shouldn't all the relevant data in the Customer tables be retrieved, regardless of whether the data was entered using CocoAdmin generated classes or manually entered in the database? Is there a work-around?
|