1
我試圖使用Hibernate在多線程應用程序源碼並獲得SQLITE_BUSY錯誤:休眠sqlite的SQLITE_BUSY
[SQLITE_BUSY] The database file is locked (database is locked)
簡化代碼重現錯誤1線:
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();
由於普遍建議我設置pool_size爲1,但它沒有幫助
<property name="connection.pool_size">1</property>
<property name="hibernate.connection.pool_size">1</property>
我使用的軟件包:
sqlite-jdbc: 3.8.7
hibernate: 4.3.8
看起來很不錯,但有一個例外:初始SessionFactory的創建failed.java.lang.NoSuchMethodError:組織。 hibernate.c3p0.internal.C3P0MessageLogger.connectionProperties(Ljava/UTIL /屬性;)V 異常在線程 「主」 java.lang.ExceptionInInitializerError \t在nl.deholtmans.HibernateHelloWorld.HibernateUtil.buildSessionFactory(HibernateUtil.java:17) \t at nl.deholtmans .HibernateHelloWorld.HibernateUtil。(HibernateUtil.java:8) \t at nl.deholtmans.HibernateHelloWorld.OneToManyExampleStockData.main(OneToManyExampleStockData.java:17) –
tjm1706
2016-11-27 16:44:44