title: The method connection() is undefined for the type Session
body: <blockquote>
    <p>The method connection() is undefined for the type Session</p>
  </blockquote>
  
  <p>I got this error when i am using prepared statement in Hibernate 5.2.2.</p>
  
  <p><strong>Issue:</strong>  </p>
  
  <pre><code>Session session = HibernateUtil.getSessionFactory().openSession();
  session.beginTransaction();
  PreparedStatement statement=session.connection().prepareStatement("INSERT INTO registration values (?,?,?)");
  </code></pre>
  
  <p>I got error in connection().I changed the hibernate version also.but i cant resolve this error.</p>