session.save (c) converts instantaneous objects into persistent objects, but the c object does not have a primary key. A primary key generation strategy is configured in the configuration file. When native, executes session.save (c), an insert statement is issued. When you hit a breakpoint in the commit method, you can see that id has a value at this time, but there is no data in the database at this time. How does c in session cache have id?
@Test
public void test2(){
Configuration conf = new Configuration().configure();
SessionFactory sessionFactory = conf.buildSessionFactory();
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
Customer c = new Customer();
c.setCust_name("");
session.save(c);
tx.commit();
session.close();
}