title: How generate DAO with Hibernate Tools in Eclipse?
body: <p>I'm using :
  Eclipse Java EE IDE Web Developers
  version:Indigo Release</p>
  
  <p>with hibernate tools, i'm new to hibernate in Eclipse, so i learn how configure the hibernate and generate the POJO's with annotations (which i think is better than .xml).</p>
  
  <p>So after generate my POJO's and DAO's i try to make a insertion, but launch a 'null point exception' to my entity manager, this is how hibernate tools is generating the dao classes:</p>
  
  <p>Trying to use the DAO generated:</p>
  
  <pre><code>public static void main(String[] args) {
  // TODO Auto-generated method stub
      User user = new User();
      user.setEmail("valter@brainset.com.br");
      user.setPassword("123456");
      user.setReputation(0);
  
      DaoUser daoUser = new DaoUser();
      daoUser.persist(user);
  }
  </code></pre>
  
  <p>DAO generated:</p>
  
  <pre><code>package com.example.pojo;
  
  // Generated 30/08/2011 20:43:29 by Hibernate Tools 3.4.0.CR1
  
  import javax.ejb.Stateless;
  import javax.persistence.EntityManager;
  import javax.persistence.PersistenceContext;
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  
  /**
   * Home object for domain model class User.
   * @see com.example.pojo.User
   * @author Hibernate Tools
   */
  @Stateless
  public class UserHome {
  
      private static final Log log = LogFactory.getLog(UserHome.class);
  
      @PersistenceContext
      private EntityManager entityManager;
  
      public void persist(User transientInstance) {
          log.debug("persisting User instance");
          try {
              entityManager.persist(transientInstance);
              log.debug("persist successful");
          } catch (RuntimeException re) {
              log.error("persist failed", re);
              throw re;
          }
      }
  
      public void remove(User persistentInstance) {
          log.debug("removing User instance");
          try {
              entityManager.remove(persistentInstance);
              log.debug("remove successful");
          } catch (RuntimeException re) {
              log.error("remove failed", re);
              throw re;
          }
      }
  
      public User merge(User detachedInstance) {
          log.debug("merging User instance");
          try {
              User result = entityManager.merge(detachedInstance);
              log.debug("merge successful");
              return result;
          } catch (RuntimeException re) {
              log.error("merge failed", re);
              throw re;
          }
      }
  
      public User findById(Integer id) {
          log.debug("getting User instance with id: " + id);
          try {
              User instance = entityManager.find(User.class, id);
              log.debug("get successful");
              return instance;
          } catch (RuntimeException re) {
              log.error("get failed", re);
              throw re;
          }
      }
  }
  </code></pre>
  
  <p>I think i must be doing something wrong in the configuration process.
  How should I set correctly my classes and dao's ?</p>