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