title: getHibernateTemplate NullPointerException
body: <p>I have a simple application to retrive a data from oracle DB:</p>
  
  <pre><code>public class userExportImpl extends HibernateDaoSupport {
  
      public User getUser (final String username) throws OssObjectNotFoundException, OssIllegalArgumentException
      {
         Session session = null;
         SessionFactory sessionFactory = new
              Configuration().configure().buildSessionFactory();
         session = sessionFactory.openSession();
         User user= null;
         createHibernateTemplate(sessionFactory);
         user = (User)getHibernateTemplate().execute( new HibernateCallback()
         {
            public Object doInHibernate(Session session) throws HibernateException, SQLException
            {
              User user = (User) session.get(User.class, username);
  
              return user;
            }
         });
      session.close();
      return user;
  }}
  </code></pre>
  
  <p>Here's the main() where i call getUser:</p>
  
  <pre><code>public class userExportTool {
  public static void main(String args[]){
     userExportImpl userExport = new userExportImpl();
     User user = userExport.getUser("test");
  }}
  </code></pre>
  
  <p>And that's the exception i get when i try to run it:</p>
  
  <pre><code>Exception in thread "main" java.lang.NullPointerException
      at com.tektronix.userExport.userExportImpl.getUser(userExportImpl.java:40)
      at com.tektronix.userExport.uacnExportTool.main(uacnExportTool.java:17)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
  </code></pre>
  
  <p>At first i thought that getHibernateTemplate requires a session factory and opened session, so i added those, but still i receive a nullPointerException and i don't have a clue why that happens.
  Both hibernate.cfg.xml and User.hbm.xml are present and i already tried working with db by simpler methods like session.get(), so connection must be fine.
  Can you please give me some ideas?</p>