gt:     if (keyValue == null)
context: // Do not edit this file!  It was generated by Melati POEM's DSD preprocessor.
  
  package org.melati.poem.test.generated;
  
  
  import org.melati.poem.AccessPoemException;
  import org.melati.poem.Column;
  import org.melati.poem.Field;
  import org.melati.poem.JdbcPersistent;
  import org.melati.poem.NoSuchRowPoemException;
  import org.melati.poem.ValidationPoemException;
  import org.melati.poem.test.Account;
  import org.melati.poem.test.AccountTable;
  import org.melati.poem.test.EverythingDatabaseTables;
  import org.melati.poem.test.User;
  
  
  /**
   * Melati POEM generated abstract base class for a <code>Persistent</code> 
   * <code>Account</code> Object.
   *
   * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
   */
  public abstract class AccountBase extends JdbcPersistent {
  
  
   /**
    * Retrieves the Database object.
    * 
    * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
    * @return the database
    */
    public EverythingDatabaseTables getEverythingDatabaseTables() {
      return (EverythingDatabaseTables)getDatabase();
    }
  
  
   /**
    * Retrieves the  <code>AccountTable</code> table 
    * which this <code>Persistent</code> is from.
    * 
    * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
    * @return the AccountTable
    */
    @SuppressWarnings("unchecked")
    public AccountTable<Account> getAccountTable() {
      return (AccountTable<Account>)getTable();
    }
  
    @SuppressWarnings("unchecked")
    private AccountTable<Account> _getAccountTable() {
      return (AccountTable<Account>)getTable();
    }
  
    // Fields in this table 
   /**
    * id 
    */
    protected Integer id;
   /**
    * user - The owner 
    */
    protected Integer user;
   /**
    * emailAddress - The owner's email address 
    */
    protected String emailAddress;
   /**
    * name - The user's name 
    */
    protected String name;
  
  
   /**
    * Retrieves the <code>Id</code> value, without locking, 
    * for this <code>Account</code> <code>Persistent</code>.
    *
    * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
    * @return the Integer id
    */
    public Integer getId_unsafe() {
      return id;
    }
  
  
   /**
    * Sets the <code>Id</code> value directly, without checking, 
    * for this Account <code>Persistent</code>.
    * 
    * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
    * @param cooked  the pre-validated value to set
    */
    public void setId_unsafe(Integer cooked) {
      id = cooked;
    }
  
   /**
    * Retrieves the Id value, with locking, for this 
    * <code>Account</code> <code>Persistent</code>.
    * 
    * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
    * @throws AccessPoemException 
    *         if the current <code>AccessToken</code> 
    *         does not confer write access rights 
    * @return the value of the field <code>Id</code> for this 
    *         <code>Account</code> <code>Persistent</code>  
    */
  
    public Integer getId()
        throws AccessPoemException {
      readLock();
      return getId_unsafe();
    }
  
  
   /**
    * Sets the <code>Id</code> value, with checking, for this 
    * <code>Account</code> <code>Persistent</code>.
    * 
    * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
    * @param cooked  a validated <code>int</code> 
    * @throws AccessPoemException 
    *         if the current <code>AccessToken</code> 
    *         does not confer write access rights
    * @throws ValidationPoemException 
    *         if the value is not valid
    */
    public void setId(Integer cooked)
        throws AccessPoemException, ValidationPoemException {
      _getAccountTable().getIdColumn().
        getType().assertValidCooked(cooked);
      writeLock();
      setId_unsafe(cooked);
    }
  
   /**
    * Sets the <code>Id</code> value, with checking, for this 
    * <code>Account</code> <code>Persistent</code>.
    * 
    * Generated by org.melati.poem.prepro.IntegerFieldDef#generateBaseMethods 
    * @param cooked  a validated <code>int</code>
    * @throws AccessPoemException 
    *         if the current <code>AccessToken</code> 
    *         does not confer write access rights
    * @throws ValidationPoemException 
    *         if the value is not valid
    */
  
    public final void setId(int cooked)
        throws AccessPoemException, ValidationPoemException {
      setId(new Integer(cooked));
    }
  
  
   /**
    * Retrieves the <code>Id</code> value as a <code>Field</code>
    * from this <code>Account</code> <code>Persistent</code>.
    * 
    * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
    * @throws AccessPoemException 
    *         if the current <code>AccessToken</code> 
    *         does not confer write access rights
    * @return the Integer id
    */
    public Field<Integer> getIdField() throws AccessPoemException {
      Column<Integer> c = _getAccountTable().getIdColumn();
      return new Field<Integer>((Integer)c.getRaw(this), c);
    }
  
  
   /**
    * Retrieves the <code>User</code> value, without locking, 
    * for this <code>Account</code> <code>Persistent</code>.
    *
    * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
    * @return the Integer user
    */
    public Integer getUser_unsafe() {
      return user;
    }
  
  
   /**
    * Sets the <code>User</code> value directly, without checking, 
    * for this Account <code>Persistent</code>.
    * 
    * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
    * @param cooked  the pre-validated value to set
    */
    public void setUser_unsafe(Integer cooked) {
      user = cooked;
    }
  
   /**
    * Retrieves the Table Row Object ID. 
    *
    * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 
    * @throws AccessPoemException  
    *         if the current <code>AccessToken</code> 
    *         does not confer read access rights 
    * @return the TROID as an <code>Integer</code> 
    */
  
    public Integer getUserTroid()
        throws AccessPoemException {
      readLock();
      return getUser_unsafe();
    }
  
  
   /**
    * Sets the Table Row Object ID. 
    * 
    * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 
    * @param raw  a Table Row Object Id 
    * @throws AccessPoemException  
    *         if the current <code>AccessToken</code> 
    *         does not confer write access rights
    */
    public void setUserTroid(Integer raw)
        throws AccessPoemException {
      setUser(raw == null ? null : 
          (User)getEverythingDatabaseTables().getUserTable().getUserObject(raw));
    }
  
  
   /**
    * Retrieves the <code>User</code> object referred to.
    *  
    * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 
    * @throws AccessPoemException  
    *         if the current <code>AccessToken</code> 
    *         does not confer read access rights 
    * @throws NoSuchRowPoemException  
    *         if the <code>Persistent</code> has yet to be allocated a TROID 
    * @return the <code>User</code> as a <code>User</code> 
    */
    public User getUser()
        throws AccessPoemException, NoSuchRowPoemException {
      Integer troid = getUserTroid();
      return troid == null ? null :
          (User)getEverythingDatabaseTables().getUserTable().getUserObject(troid);
    }
  
  
   /**
    * Set the User.
    * 
    * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 
    * @param cooked  a validated <code>User</code>
    * @throws AccessPoemException  
    *         if the current <code>AccessToken</code> 
    *         does not confer write access rights 
    */
    public void setUser(User cooked)
        throws AccessPoemException {
      _getAccountTable().
        getUserColumn().
          getType().assertValidCooked(cooked);
      writeLock();
      if (cooked == null)
        setUser_unsafe(null);
      else {
        cooked.existenceLock();
        setUser_unsafe(cooked.troid());
      }
    }
  
  
   /**
    * Retrieves the <code>User</code> value as a <code>Field</code>
    * from this <code>Account</code> <code>Persistent</code>.
    * 
    * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
    * @throws AccessPoemException 
    *         if the current <code>AccessToken</code> 
    *         does not confer write access rights
    * @return the Integer user
    */
    public Field<Integer> getUserField() throws AccessPoemException {
      Column<Integer> c = _getAccountTable().getUserColumn();
      return new Field<Integer>((Integer)c.getRaw(this), c);
    }
  
  
   /**
    * Retrieves the <code>EmailAddress</code> value, without locking, 
    * for this <code>Account</code> <code>Persistent</code>.
    *
    * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
    * @return the String emailAddress
    */
    public String getEmailAddress_unsafe() {
      return emailAddress;
    }
  
  
   /**
    * Sets the <code>EmailAddress</code> value directly, without checking, 
    * for this Account <code>Persistent</code>.
    * 
    * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
    * @param cooked  the pre-validated value to set
    */
    public void setEmailAddress_unsafe(String cooked) {
      emailAddress = cooked;
    }
  
   /**
    * Retrieves the Table Row Object ID. 
    *
    * Generated by org.melati.poem.prepro.StringKeyReferenceFieldDef#generateBaseMethods 
    * @throws AccessPoemException  
    *         if the current <code>AccessToken</code> 
    *         does not confer read access rights 
    * @return the TROID as an <code>Integer</code> 
    */
  
    public Integer getEmailAddressTroid()
        throws AccessPoemException {
      String keyValue = getEmailAddress_unsafe();
  