Wiki source code of Client-Side Entity.java Template
Last modified by David Avendasora on 2009/04/07 07:21
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{code}} | ||
2 | #if ($entity.packageName) | ||
3 | package $entity.packageName; | ||
4 | |||
5 | #end | ||
6 | import org.apache.log4j.Logger; | ||
7 | |||
8 | import com.webobjects.eocontrol.EOEditingContext; | ||
9 | |||
10 | public class ${entity.classNameWithoutPackage} extends ${entity.prefixClassNameWithOptionalPackage} { | ||
11 | |||
12 | @SuppressWarnings("unused") | ||
13 | private static Logger log = Logger.getLogger(${entity.classNameWithoutPackage}.class); | ||
14 | |||
15 | public ${entity.classNameWithoutPackage}() { | ||
16 | super(); | ||
17 | // Don't do anything here! All initial object setup must | ||
18 | // be done in the awakeFromInsertion(EOEditingContext) method. | ||
19 | } | ||
20 | |||
21 | @Override | ||
22 | public void awakeFromInsertion(EOEditingContext ec) { | ||
23 | super.awakeFromInsertion(ec); | ||
24 | /* | ||
25 | * All attributes you set here should be wrapped in a if(attribute == null) conditional, otherwise | ||
26 | * many bad things can happen as new instances are copied back from the java client and inserted into | ||
27 | * the server-side editing context! | ||
28 | */ | ||
29 | } | ||
30 | } | ||
31 | |||
32 | {{/code}} |