Linked Questions

Popular Questions

I took care of commiting transaction, but database remains empty after saving object. No errors, hibernate even shows SQL command of inserting. Everything is ok when I add <property name="hibernate.connection.autocommit">true</property> line to my hibernate config xml, but I heard that this is not a good practice. I'm using HSQLDB database.

Here's piece of my code that inserts data.

    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    session.beginTransaction();
    Client c = new Client();
    c.setImie("John");
    c.setNazwisko("Kennedy"); 
    session.save(c);
    session.getTransaction().commit();
    session.close();

Related Questions