Code example for SessionFactory

Methods: openSession

0
    public void testSpringHibernateTransaction() throws Exception {
        compass.getSearchEngineIndexManager().deleteIndex();
        compass.getSearchEngineIndexManager().verifyIndex();
 
 
        Session session = sessionFactory.openSession();
        Transaction transaction = session.beginTransaction();
        Simple simple = new Simple();
        simple.setId(1);
        simple.setValue("value1");
        session.save("simple", simple);
        simple = new Simple();
        simple.setId(2);
        simple.setValue("value2");
        session.save("simple", simple);
        simple = new Simple();
        simple.setId(3);
        simple.setValue("value3");
        session.save("simple", simple);
 
Contextual code suggestions in your IDE  Get Codota for Java