mardi 31 mars 2015

Hibernate sqlite SQLITE_BUSY

I am trying to use hibernate with sqlite in multi-threaded application and getting SQLITE_BUSY error:



[SQLITE_BUSY] The database file is locked (database is locked)


Simplified code which reproduces error in 1 thread:



Session session = sessionFactory.openSession();
session.beginTransaction();
session.save(new Object());
session.flush();

Session session2 = sessionFactory.openSession();
session2.beginTransaction();
session2.save(new Object());
session2.getTransaction().commit();


As widely suggested i set pool_size to 1, but it didn't help



<property name="connection.pool_size">1</property>
<property name="hibernate.connection.pool_size">1</property>


packages that i use:



sqlite-jdbc: 3.8.7
hibernate: 4.3.8

Aucun commentaire:

Enregistrer un commentaire