Server-Side Entity.java Template
Last modified by David Avendasora on 2009/04/07 07:22
#if ($entity.packageName)
package $entity.packageName;
#end
import org.apache.log4j.Logger;
import com.webobjects.eoaccess.EOUtilities;
import com.webobjects.eocontrol.EOEditingContext;
public class ${entity.classNameWithoutPackage} extends ${entity.prefixClassNameWithOptionalPackage} {
@SuppressWarnings("unused")
private static Logger log = Logger.getLogger(${entity.classNameWithoutPackage}.class);
private static final long serialVersionUID = 1L;
public ${entity.classNameWithoutPackage}() {
super();
// Don't do anything here! All initial object setup must
// be done in the awakeFromInsertion(EOEditingContext) method.
}
public ${entity.classNameWithoutPackage} localInstance(EOEditingContext ec) {
return (${entity.classNameWithoutPackage}) EOUtilities.localInstanceOfObject(ec, this);
}
@Override
public void awakeFromInsertion(EOEditingContext ec) {
super.awakeFromInsertion(ec);
/*
* All attributes you set here should be wrapped in a if(attribute == null) conditional, otherwise
* many bad things can happen as new instances are copied back from the java client and inserted into
* the server-side editing context!
*/
}
}
package $entity.packageName;
#end
import org.apache.log4j.Logger;
import com.webobjects.eoaccess.EOUtilities;
import com.webobjects.eocontrol.EOEditingContext;
public class ${entity.classNameWithoutPackage} extends ${entity.prefixClassNameWithOptionalPackage} {
@SuppressWarnings("unused")
private static Logger log = Logger.getLogger(${entity.classNameWithoutPackage}.class);
private static final long serialVersionUID = 1L;
public ${entity.classNameWithoutPackage}() {
super();
// Don't do anything here! All initial object setup must
// be done in the awakeFromInsertion(EOEditingContext) method.
}
public ${entity.classNameWithoutPackage} localInstance(EOEditingContext ec) {
return (${entity.classNameWithoutPackage}) EOUtilities.localInstanceOfObject(ec, this);
}
@Override
public void awakeFromInsertion(EOEditingContext ec) {
super.awakeFromInsertion(ec);
/*
* All attributes you set here should be wrapped in a if(attribute == null) conditional, otherwise
* many bad things can happen as new instances are copied back from the java client and inserted into
* the server-side editing context!
*/
}
}