Synchronize Model and Code


In addition to generating and importing code, Enterprise Architect provides the option to synchronize the model and source code, creating a model that represents the latest changes in the source code and vice versa. You can use either the model as the source, or the code as the source.

For example: you generated some source code, but made subsequent changes to the model. When you generate code again, Enterprise Architect adds any new attributes or methods to the existing source code, leaving intact what already exists. This means developers can work on the source code and then generate additional methods as required from the model, without having their code overwritten or destroyed.


Code synchronization does not change method bodies. Behavioral code generation only works when generating the entire file.

Similarly, you might have made changes to a source code file, but the model has detailed notes and characteristics you do not want to lose. By synchronizing from the source code into the model, you import additional attributes and methods but do not change other model elements.

Using the two synchronization methods above, it is simple to keep source code and model elements up to date and synchronized.


In the Corporate, Business and Software Engineering, System Engineering and Ultimate editions of Enterprise Architect, if security is enabled you must have Generate Source Code and DDL permission to synchronize source code with model elements.

Synchronize Classes on Forward Generation

When there are features present in the code but not in the model you can use the following buttons during forward synchronization:


These buttons are only available when the On forward synch, prompt to delete code features not in model checkbox is selected in the Options - Attributes and Operations dialog.

  • Delete: when you click on this button the selected code features are removed from the code.
  • Reassign: when you click on this button the code elements are reassigned to elements in the model (this is only possible when an appropriate model element is present that is not already defined in the code).
  • Ignore: when you click on this button the code elements not present in the model are ignored completely.
  • Reset to Default: when you click on this button the settings for synchronizing during forward generation are set to Ignore, meaning that the elements present in the code but not in the model are ignored completely.