Hi all,
I'm using hibernate with the bellow configuration:
Ejb3Configuration cfg = new Ejb3Configuration();
m_entityManagerFactory = cfg
.setProperty(Environment.DIALECT,"org.hibernate.dialect.SQLServerDialect")
.setProperty(Environment.CACHE_PROVIDER, "org.hibernate.cache.HashtableCacheProvider")
//.setProperty(Environment.CACHE_PROVIDER, "org.hibernate.cache.EhCacheProvider")
//.setProperty(Environment.GENERATE_STATISTICS, "true")
//.setProperty(Environment.USE_STRUCTURED_CACHE, "true")
.setProperty(Environment.USER, db.getUser())
.setProperty(Environment.PASS, db.getPassword())
.setProperty(Environment.URL, db.getSid())
.setProperty(Environment.DRIVER,db.getDriver())
.setProperty(Environment.SHOW_SQL, String.valueOf(InitServlet.IN_DEBUG_MODE))
//.setProperty(Environment.FORMAT_SQL,String.valueOf(InitServlet.IN_DEBUG_MODE))//Pretty print the SQL
//initialPoolSize C3P0 default: 3
//maxPoolSize - Hibernate default: 100
.setProperty(Environment.C3P0_MAX_SIZE, "100")
//minPoolSize - Hibernate default: 1
.setProperty(Environment.C3P0_MIN_SIZE, "5")
//timeout - The seconds a Connection can remain pooled but unused before being discarded.
//Zero means idle connections never expire. Hibernate default: 0
.setProperty(Environment.C3P0_TIMEOUT, "1800")//in sec
.setProperty(Environment.C3P0_MAX_STATEMENTS, "100")//0 to turn off c3p0 statement cache
//idle_test_period - If this is a number greater than 0, c3p0 will test all idle, pooled but unchecked-out connections,
//every this number of seconds.
.setProperty(Environment.C3P0_IDLE_TEST_PERIOD, "300")//in sec
I have 2 tables in Database with FK constraint validation sometimes after delete the parent record ( saw that the record was delete from database) trying to delete the child and recived :
SQLServerException: The DELETE statement conflicted with the REFERENCE constraint .
each delete use different EntityManager and transaction.
thanks
|