There are 3 techniques that can be used to be able to preserve custom source code across source code generations of the mapping tool, depending on the version of VBSF: I. Version 2.2 supports the preservation of existing code via the PRESERVED_CODE tag. Changes to the source code of existing classes can be preserved from generation to generation by means of the new %PRESERVED_CODE% tag. This tag must be placed in 2 places: 1. In the template file to specify where the preserved source code block should be placed. See the template4.tmpl file in the samples schrepository directory. 2. In the actual source code inside comments to delimit the preserved code. For example: /* PRESERVED_CODE */ custom code is here, including additional non-persistent attributes, methods, static variables and methods, constructors, comments, etc. /* PRESERVED_CODE */ Note that only one PRESERVED_CODE code block is allowed per class. II. In v2.1x and below, a technique of extending the generated classes can be used. To do this, use the following procedure: 1. Change the source template to add a suffix or prefix to the package name. For example, starting with the package declaration line below: package %PACKAGE_NAME%; add a suffix to it as shown below: package %PACKAGE_NAME%.data; or add a prefix to it as shown below: package generated.%PACKAGE_NAME%; If, for example, the persistent classes defined in the mapping tool belong to the 'com.mycompany' package, then with the above suffix modification the mapping tool would generate classes as shown below: package com.mycompany.data; public class Customer { /* persistent attributes */ /* accessors & mutators */ } And with the prefix modification the mapping tool would generate classes as shown below: package generated.com.mycompany; public class generated.com.mycompany.Customer { /* persistent attributes */ /* accessors & mutators */ } 2. Manually create your class as a subclass of the generated class using the same package name as defined in the mapping tool and put all the additional logic. In the case where a suffix was added, then your subclass would be defined as shown below: package com.mycompany; public class Customer extends com.mycompany.data.Customer { /* additional non-persistent attributes and logic methods go here */ } The VBSF runtime will persist your subclasses, and you can regenerate the generated classes as many times as you want without overwriting your own subclasses. Also note that all persistent attributes should be defined as protected so they can be accessed by your subclasses. III. The last technique is demonstrated in the vposdemo2 sample application. It is also based on extending a persistent base class, but requires both the subclass and the superclass to be defined in the mapping tool. For details, see the Invoice and InvoiceLine classes in the vposdemo2 sample application. (c) 1998-2001 Objectmatter, Inc. All rights reserved. TRADEMARKS. Products and company names mentioned herein are the trademarks of their respective owners.