Hi,
All (but one) my tables have a technical autogenerated primary key, this
works very well with cayenne.
now I have 1 table with a composite PK:
CREATE TABLE rates(
projectid int4 NOT NULL,
employeeid int4 NOT NULL,
rate numeric NOT NULL,
FOREIGN KEY (projectid) REFERENCES projects (id),
FOREIGN KEY (employeeid) REFERENCES employees (id),
PRIMARY KEY (projectid,employeeid));
now when i try to insert a new Rates object:
(I've defined the relations toemployee and toproject in cayenne modeler)
Employees theemployee =
EmployeeService.findEmployeeByID(theDataContext, employeesID);
Projects theproject =
ProjectsService.findProjectsByID(theDataContext, projectsID);
Rates theRate2Insert = new Rates();
theDataContext.registerNewObject(theRate2Insert);
theRate2Insert.setToEmployees(theemployee);
theRate2Insert.setToProject(theproject);
theRate2Insert.setRate(amount);
theDataContext.commitChanges(Level.WARN);
I get a:CayenneRuntimeException
Primary Key autogeneration only works for a single attribute.
but I've set the primary keys by setting the relations, which are the PK,
can I tell cayenne, to not try to generate a PK?
thanks for help
martin
This archive was generated by hypermail 2.0.0 : Sat Jan 18 2003 - 04:06:29 EST