Hi I am using TENEO which in turn uses Hibernate.
TENEO is having an ecore model and it will be loaded with a file of size 60MB.
The ecore will be persisted in database using Hibernate by TENEO. But this process is taking too long time.
My Properties settings are as below
Code:
props.setProperty(Environment.DIALECT, org.hibernate.dialect.Oracle10gDialect.class.getName());
props.setProperty(Environment.DEFAULT_SCHEMA,"MARS_DGS_ADMIN");
props.setProperty("hibernate.temp.use_jdbc_metadata_defaults","false");
props.setProperty(PersistenceOptions.CASCADE_POLICY_ON_NON_CONTAINMENT,"REFRESH,PERSIST,MERGE");
props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,"JOINED");
props.setProperty("teneo.mapping.default_cache_strategy","READ_WRITE");
props.setProperty("hibernate.cache.region.factory_class", "org.hibernate.cache.ehcache.EhCacheRegionFactory");
props.setProperty("hibernate.cache.use_second_level_cache","true");
props.setProperty("teneo.mapping.always_version","false");
props.setProperty("teneo.mapping.disable_econtainer","true");
props.setProperty(Environment.HBM2DDL_AUTO, "create");
props.setProperty("teneo.naming.max_sql_name_length","30");
props.setProperty("hibernate.jdbc.batch_size", "30");
And the code that writes data to DB is below
Code:
final SessionFactory sessionFactory = hbds.getSessionFactory();
{
// Open a new Session and start transaction.
final Session session = sessionFactory.openSession();
session.beginTransaction();
session.save(tempSession); // Taking too long time
// Commit the changes to the database.
session.getTransaction().commit();
}
How to solve this problem?
My ecore is having 25 EClass. Loading the 60Mb file to model takes 6 seconds but insertion of data takes 1 hour!!!