title: When do you register classes in Objectify for GAE?
body: <p>So this might be kind of a dumb question but when do you register classes with:</p>
  
  <pre><code>ObjectifyService.register( User.class );
  </code></pre>
  
  <p>Currently, I'm doing this in the constructor of an interface-like class that I use in my other classes to simplify usage of the Data store specifically to my application. However, I'm getting this error:</p>
  
  <blockquote>
    <p>Attempted to register kind 'User' twice</p>
  </blockquote>
  
  <p>So, I guess my question is how often and specifically when do you register classes in Objectify?</p>
  
  <p>Thanks!</p>
  
  <p>P.S. Here's my entire class:</p>
  
  <pre><code>import java.security.InvalidKeyException;
  import java.security.NoSuchAlgorithmException;
  import java.util.Iterator;
  
  import javax.crypto.BadPaddingException;
  import javax.crypto.IllegalBlockSizeException;
  import javax.crypto.NoSuchPaddingException;
  import javax.persistence.Id;
  
  import com.googlecode.objectify.Objectify;
  import com.googlecode.objectify.ObjectifyService;
  import com.googlecode.objectify.annotation.Indexed;
  import com.googlecode.objectify.annotation.Unindexed;
  
  public class UsersService {
  
      Objectify ojy;
  
      public UsersService(){
          ObjectifyService.register( User.class );
          ojy = ObjectifyService.begin();
      }
  
      public void regUser(String email, String password, String firstName, String lastName){
          //TODO: Check syntax if email
          //TODO: store encrypted password
      }
  
      public void regUser(String email, String password, String firstName){
          regUser(email, password, firstName, null);
      }
  
      public void regUser(String email, String password){
          regUser(email, password, "", "");
      }
  
      public boolean checkFor(Long acc_id){
          User checked_user = ojy.find(User.class, acc_id);
          if(checked_user == null){
              return false;
          }else{
              return true;
          }
      }
  
      public User getUser(String email, String password) throws InvalidKeyException, IllegalBlockSizeException, BadPaddingException, NoSuchAlgorithmException, NoSuchPaddingException{
          String pass_enc = MyUtils.getEncrypted(password);
          Iterable&lt;User&gt; users = ojy.query(User.class).filter("email", email).filter("password", pass_enc);
          Iterator&lt;User&gt; iter = users.iterator();
          if(iter.hasNext()){
              return iter.next();
          }else{
              return null;
          }
      }
  
  }
  </code></pre>