cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tore Halset <>
Subject Re: CayenneModeler and Reengineering Database Schema
Date Tue, 27 Nov 2007 14:54:52 GMT

Currently (next milestone), you mark the datamap in the modeler and  
select "Tools->Migrate Database Schema". After connecting to a  
database, a new dialog will pop up and show the (supported) changes  
between the model and the database. For each diff, you can choose to  
ignore, merge to db or merge to model.

I have implemented merge tokens for the most important changes for my  
self. It include adding/removing tables and columns, changing char/ 
varchar length and changing not null. It does not yet support forreign  
keys, primary keys, default values for not null and so on. It should  
not be that hard to expand with new tokens.

Currently, this is supported (custom alter table syntax) for MS SQL  
Server, Derby, PostgreSQL and hsql as I do not have access to any  
other database engines. This will hopefully expand.

Take a look at the screenshots:

(I should really write this down in the wiki thingi..)

  - Tore.

On Nov 27, 2007, at 15:31 , Michael Lepine wrote:

> Very interesting. This sounds like what I'm looking for. Is there a
> link that contains a little more information on how this will work, or
> if you have a minute, would you give a brief synopsis of how this will
> be supported by the Modeler?
> On Nov 27, 2007 8:26 AM, Tore Halset <> wrote:
>> Hello.
>> I think this is handled by the merge-stuff I have worked on. It will
>> be included in the next 3.0 milestone.
>> Regards,
>> - Tore.
>> On Nov 26, 2007, at 23:06 , Michael Lepine wrote:
>>> Hello all.
>>> I am currently using CayenneModeler version 2.0.3 to reengineer a
>>> database schema and generate the subsequent Java classes. Some of  
>>> the
>>> ObjEntity instances have primary/foreign keys mapped manually  
>>> because
>>> these keys are generated by another process (outside of the Cayenne
>>> framework). The schema that I manage is very large and is  
>>> periodically
>>> updated as part of maintenance and new development tasks. In order  
>>> to
>>> update the model ( file) with the schema changes, I go
>>> through a fairly tedious process that involves the following:
>>> 1. update database schema
>>> 2. copy cayenne configuration files (cayenne.xml, and
>>> ...driver.xml) to a temp directory
>>> 3. start CayenneModeler
>>> 4. open the project from the temp directory
>>> 5. run Tools > Reengineer Database Schema
>>> 6. when prompted that a table exists, I opt to overwrite it to  
>>> ensure
>>> I get all updates
>>> 7. save (temp) project
>>> 8. compare the differences between the temp map.xml and original
>>> map.xml files, manually copying the updates from the original to the
>>> temp file
>>> 9. test that I haven't made mistakes by opening the temp project and
>>> then double-checking it visually if it loads
>>> I do this because the manual mappings in the ObjEntity instances are
>>> removed when I run Reengineer Database Schema which does not seem  
>>> like
>>> desired behavior. I would expect manual attribute mappings created  
>>> in
>>> the ObjEntity instances to remain after reengineering a schema if:
>>> 1. the same schema is being reengineered
>>> 2. the corresponding DbEntity attribute still exists
>>> I downloaded the 2.0.4 and 3.0M2 versions of the Modeler to see if  
>>> the
>>> behavior was different. It appears that manually mapped ObjEntity
>>> attributes are dropped in all versions under the above scenario.
>>> Is there an easier/more efficient way to update my model (map.xml)
>>> files?
>>> Has anyone else encountered a similar issue?
>>> Thank you for your help.
>>> - Mike

View raw message