title: hibernate-- org.hibernate.TransactionException: Transaction not successfully started
body: <p>am a beginner in hibernate. when am trying to save an object into the DB for which the table is not present. Am getting an exception 
      org.hibernate.TransactionException: Transaction not successfully started    at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:170)    at org.rk.hibernate.HibernateTest.main(HibernateTest.java:20)</p>
  
  <p>this is my class file where am trying to save the object into DB</p>
  
  <pre><code>package org.rk.hibernate;
  
  import org.hibernate.HibernateException;
  import org.hibernate.Session;
  import org.hibernate.SessionFactory;
  import org.hibernate.cfg.Configuration;
  import org.rk.dto.UserDetails;
  
  public class HibernateTest {
  
      public static void main(String[] args) {
          UserDetails user = new UserDetails();
          user.setUserId(1);
          user.setUserName("GNS");
          try {       
              SessionFactory sf = new Configuration().configure().buildSessionFactory();
              Session session = sf.openSession();
              session.save(user);
              session.getTransaction().commit();
          }
          catch(HibernateException e) {
              e.printStackTrace();
              System.out.println("in exception");
          }
      }
  }
  </code></pre>
  
  <p>Am using oracle 11g release 2 and hibernate 4.2.4 .. Please help</p>