Moving this to the list, since it maybe useful to others- I have been poking around, and I think I've figured out how to use it. If I use DbGenerator, everything works great, but if I try to merge in changes from a slightly out of sync schema with DbMerger, it looks like invalid SQL is generated.
I'm using Derby with 3.0M4, and the relevant offending samples are: 1) Syntax error: Encountered "SET" at line 1, column 43. ALTER TABLE bnlogin ALTER COLUMN lastSeen SET NOT NULL 2) Foreign Key 'SQL080826163049030' is invalid because 'The table cannot be defined as a dependent of table APP.ACCOUNT because of delete rule restrictions. (The relationship causes the table to be delete-connected to the indicated table through multiple relationships and the delete rule of the existing relationship is SET NULL.). '. ALTER TABLE mail ADD FOREIGN KEY (sentto) REFERENCES account (id) 3) Syntax error: Encountered "DROP" at line 1, column 39. ALTER TABLE rank ALTER COLUMN verbstr DROP NOT NULL It looks as if 1 and 3 are simply SQL syntax errors, but 2 is a vastly more complex logical problem. I don't have time to go in to detail about how to reproduce it at the moment, but I believe the fix is to drop the alternate FK and rebuild both. Is it safe to assume that problems like this are a product of the package being incomplete, or is it indeed a bug? Thanks, Scott -----Original Message----- From: Tore Halset [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2008 2:30 PM To: Scott Anderson Subject: Re: DbGenerator vs. MergeContext On Aug 26, 2008, at 19:25, Scott Anderson wrote: > Are there any examples of how to do this in code? It would be nice to > have Cayenne do all the heavy lifting here, since the idea of passing > around SQL patches is fairly daunting. :) I just created a simple page for using the merger from the modeler. I will have to create a page for using it from code as well. Sorry. http://cwiki.apache.org/confluence/display/CAYDOC/Migrate+changes+betwee n+model+and+database - Tore.
