title: org.hibernate.HibernateException in a basic hibernate program
body: <p>I get the following error <code>session.save(student);</code></p>
  
  <pre><code>org.hibernate.HibernateException: The database returned no natively generated identity value
  </code></pre>
  
  <p>Here is main function </p>
  
  <pre><code>{
    BasicConfigurator.configure();
    Session session = HibernateUtil.getSessionFactory().openSession();
    Transaction transaction = null;
    try {
     transaction = session.beginTransaction();
     Address address = new Address("Outer Ring Road", "Delhi", "TN", "110001");
     Student student = new Student("kumar", address);
     session.save(student);
     transaction.commit();
       } catch (HibernateException e) {
  
     if (transaction != null) {
        transaction.rollback();
  
      }
     e.printStackTrace();
    } finally {
     session.close();
   }
  }
  </code></pre>