title: java.lang.UnsupportedOperationException: The application must supply JDBC connections
body: <p>I write some code to test my configuration of Hibernate.But I come across such error message:</p>
  
  <pre><code>java.lang.UnsupportedOperationException: The application must supply JDBC connections
  at org.hibernate.engine.jdbc.connections.internal.UserSuppliedConnectionProviderImpl.getConnection(UserSuppliedConnectionProviderImpl.java:61)
  at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:380)
  at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:228)
  at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:171)
  at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:67)
  at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:162)
  at org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1435)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method.invoke(Unknown Source)
  at org.hibernate.context.internal.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:356)
  at com.sun.proxy.$Proxy0.beginTransaction(Unknown Source)
  </code></pre>
  
  <p>My file structure is like below:</p>
  
  <pre class="lang-none prettyprint-override"><code>src
  ---test
  -------Test.java(with main function)
  -------User.java
  -------User.hbm.xml
  ----hibernate.cfg.xml
  </code></pre>
  
  <p>This is not a web application,it's just an ordinary java project.The hibernate.cfg.xml is like below:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;!DOCTYPE hibernate-configuration PUBLIC
      "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
      "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt;
      &lt;hibernate-configuration&gt;
  
      &lt;session-factory&gt;
          &lt;!-- Configure MySQL --&gt;
          &lt;property name="hibernate.connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt;
          &lt;property name="hibernate.connection.URL"&gt;jdbc:mysql://localhost:3306/mags&lt;/property&gt;
          &lt;property name="hibernate.connection.username"&gt;root&lt;/property&gt;
          &lt;property name="hibernate.connection.password"&gt;bysjysf&lt;/property&gt;
          &lt;property name="show_sql"&gt;true&lt;/property&gt;
          &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt;
          &lt;property name="hibernate.current_session_context_class"&gt;thread&lt;/property&gt;
          &lt;!-- Mapping Files --&gt;
          &lt;mapping resource="test/User.hbm.xml" /&gt;
      &lt;/session-factory&gt;
  
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>The code in main function is like below:</p>
  
  <pre><code>public static void main(String[] args) {
      // TODO Auto-generated method stub
      Configuration cfg = new Configuration().configure("hibernate.cfg.xml");         
      StandardServiceRegistryBuilder sb = new StandardServiceRegistryBuilder();
      sb.applySettings(cfg.getProperties());
      StandardServiceRegistry standardServiceRegistry = sb.build();                   
      SessionFactory sessionFactory = cfg.buildSessionFactory(standardServiceRegistry);
      Session session = sessionFactory.getCurrentSession();
      System.out.println(session);
      Transaction tx = session.beginTransaction();
      User user = new User();
      user.setPassword("aaaa");
      user.setUsername("ysf");
      user.setAuthority(1);
      session.save(user);
      tx.commit();
      session.close();
  
  }
  </code></pre>
  
  <p>According the error message, the error occurred in </p>
  
  <pre><code>Transaction tx = session.beginTransaction();
  </code></pre>
  
  <p>I am a new user for Hibernate,and I have check my configuration file many times.Could any one help to figure out what the problem is? Thanks!</p>
  
  <p>EDIT:the Hibernate version is 4.3.5</p>