Hibernate - Application - pom.xml
  <project xmlns="http://maven.apache.org/POM/4.0.0" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>hibernate6</groupId>
    <artifactId>Hibernate6App</artifactId>
    <version>0.0.1-SNAPSHOT</version>

  </project>
Hibernate - Configuration - hibernate-cfg.xml
                        <?xml version = "1.0" encoding = "utf-8"?>
                        <!DOCTYPE hibernate-configuration SYSTEM 
                        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">  
                        <hibernate-configuration>
                             <session-factory>
                             <property name="hibernate.connection.driver_class">com.mysql.cj.jdbc.Driver</property>
                             <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/hdb</property>
                             <property name="hibernate.connection.username">root</property>
                             <property name="hibernate.connection.password">root</property>
                             <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
                             <property name="hibernate.autocommit">false</property>
                             <property name="hibernate.show_sql">true</property>
                             <property name="hibernate.hbm2ddl.auto">update</property> 
                             <mapping resource="hibernate.hbm.xml"/>
                             </session-factory> 
                        </hibernate-configuration> 
                        
Hibernate - Mapping File - student.hbm.xml
                        <?xml version = "1.0" encoding = "utf-8"?>
                        <!DOCTYPE hibernate-mapping SYSTEM 
                        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
                        <hibernate-mapping>
                          <class name="com.hibernate6.entity.Student" table="StudentInfo">
                              <id name="sno" column="sno"/>
                              <property name="sname" column="sname"/>
                              <property name="marks" column="marks"/>   
                          </class>	
                        </hibernate-mapping>
                      
Class Name: Student.java created in xxx.xxx.entity
                    package com.hibernate6.entity;
                    public class Student {
                      private int sno;
                      private String sname;
                      private double marks;
                      public int getSno() {
                        return sno;
                      }
                      public void setSno(int sno) {
                        this.sno = sno;
                      }
                      public String getSname() {
                        return sname;
                      }
                      public void setSname(String sname) {
                        this.sname = sname;
                      }
                      public double getMarks() {
                        return marks;
                      }
                      public void setMarks(double marks) {
                        this.marks = marks;
                      }	
                    }
                  
Class Name: HibernateUtil.java created in xxx.xxx.utility
                  package com.hibernate6.utility;
                  
                  import org.hibernate.SessionFactory;
                  import org.hibernate.boot.Metadata;
                  import org.hibernate.boot.MetadataSources;
                  import org.hibernate.boot.registry.StandardServiceRegistry;
                  import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
                  
                  public class HibernateUtil {
                    private static StandardServiceRegistry registry;
                    private static SessionFactory sessionFactory;
                    public static SessionFactory getSessionFactory() {
                      if(sessionFactory==null) {
                        try{
                          registry=new StandardServiceRegistryBuilder().configure().build();
                          MetadataSources sources=new MetadataSources(registry);
                          Metadata metadata=sources.getMetadataBuilder().build();
                          sessionFactory= metadata.getSessionFactoryBuilder().build();
                        }	catch(Exception e) {
                         e.printStackTrace(); 
                        }			
                      }		
                      return sessionFactory;
                    }
                  }
                  
                
Class Name: HibernateTest.java created in xxx.xxx.test
                  package com.hibernate6.test;

                  import org.hibernate.Session;
                  import org.hibernate.SessionFactory;
                  import org.hibernate.Transaction;
                  
                  import com.hibernate6.entity.Student;
                  import com.hibernate6.utility.HibernateUtil;
                  
                  public class HibernateTest {
                    @SuppressWarnings("deprecation")
                    public static void main(String args[]) {
                    SessionFactory sessionFactory=HibernateUtil.getSessionFactory();
                    Session session=sessionFactory.openSession();
                    /*
                     * String version = (String)
                     * session.createNativeQuery("select version()").getSingleResult();
                     * System.out.println("MySQL Version: "+version);
                     */
                      Transaction tx=session.beginTransaction();
                      Student s=new Student();
                      s.setSno(125);
                      s.setSname("Lakshmi");
                      s.setMarks(489.0);
                      session.persist(s);	
                      tx.commit();
                      session.close();
                    }
                  }