Middlegen doesn't support this, but maybe CMR doesn't either...
 
I've got a person bean, and a manages table which defines the managers for a person.
 
CREATE TABLE person          (
       email varchar(256) PRIMARY KEY,
       name varchar(256) NOT NULL,

);
CREATE TABLE manages (
       manager varchar(256) NOT NULL,
       target varchar(256) NOT NULL,
       FOREIGN KEY (target) REFERENCES person ON DELETE CASCADE ON UPDATE CASCADE,
       FOREIGN KEY (manager) REFERENCES person ON DELETE CASCADE ON UPDATE CASCADE
);
I realize it's weird for a person to have more than one manager, but it happens..  So I'd expect middlegen to produce the equivalent of a getManagers() method and a getDirectReports() method.  Instead, it makes a methods called
 
public abstract java.util.Collection getPersons-by--target--manager();
public abstract void setPersons-by--target--manager(java.util.Collection persons-by--target--manager);
Which of course doesn't compile because of the hyphens.  Is this type of thing even allowed by the CMR spec?  It seems like a not-to-uncommon pattern.  If CMR supports it, is there a way to get middlegen to do this? (Incidentally, middlegen does handle one-to-many relationships involving the same bean)
 
Russell

Reply via email to