Hi I'm using hibernate 3.2 rc2 and I'm having some trouble with hibernate initialization time.
I've made some searches here at the forum and they helped me to decrease the mappings reading time.
Every Mapped Class points to the Hibernte 3.0 DTD.
I've also switched the CGLIB reflection optimizer off but it didn't make any diference.
My application contains 168 mapping classes, and I'm adding each one of them by using the Configuration().addCacheableFile() method, so I guess the mappings reading time is not an issue here. The problem is: when the buildSessionFactory starts it really gets a bit slow. Check the log below:
Code:
15:48:54,700 INFO Environment:509 - hibernate.properties not found
15:48:54,704 INFO Environment:525 - using CGLIB reflection optimizer
15:48:54,707 INFO Environment:555 - using JDK 1.4 java.sql.Timestamp handling
15:48:56,401 INFO Configuration:294 - Reading mappings from cache file: /home/lucas/workspace/Autobahn1.5/bin/Utilitarios/Pessoa/Socio.hbm.xml.bin
15:48:56,914 INFO HbmBinder:265 - Mapping class: Utilitarios.Pessoa.Socio -> Socio
15:48:57,509 INFO Configuration:294 - Reading mappings from cache file: /home/lucas/workspace/Autobahn1.5/bin/Utilitarios/Pessoa/Usuario.hbm.xml.bin
15:48:57,525 INFO HbmBinder:265 - Mapping class: Utilitarios.Pessoa.Usuario -> Usuario
(...)
(... more mappings here ...)
(...)
15:49:01,476 INFO Configuration:294 - Reading mappings from cache file: /home/lucas/workspace/Autobahn1.5/bin/Comercial/GD_Comercial/HistoricoComissao.hbm.xml.bin
(...)
15:49:02,353 INFO HbmBinder:2276 - Mapping collection: Utilitarios.Pessoa.PessoaJuridica.arquivo -> arquivoanexo
(...)
(... more mappings here ...)
(...)
15:49:02,655 INFO HbmBinder:2276 - Mapping collection: Financeiro.DP_Financeiro.OrdemPagamento.financiamentoVeiculo -> FinanciamentoVeiculo
15:49:02,663 INFO Configuration:1035 - processing association property references
15:49:02,665 INFO Configuration:1057 - processing foreign key constraints
15:49:02,748 INFO C3P0ConnectionProvider:50 - C3P0 using driver: org.postgresql.Driver at URL: jdbc:postgresql://192.168.1.1:5432/dataBase
15:49:02,749 INFO C3P0ConnectionProvider:51 - Connection properties: {user= , password=**********************}
15:49:02,749 INFO C3P0ConnectionProvider:54 - autocommit mode: false
15:49:03,606 INFO SettingsFactory:77 - RDBMS: PostgreSQL, version: 8.1.1
15:49:03,608 INFO SettingsFactory:78 - JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 8.0 JDBC3 with SSL (build 310)
15:49:03,630 INFO Dialect:103 - Using dialect: org.hibernate.dialect.PostgreSQLDialect
15:49:03,640 INFO TransactionFactoryFactory:31 - Using default transaction strategy (direct JDBC transactions)
15:49:03,643 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
15:49:03,644 INFO SettingsFactory:125 - Automatic flush during beforeCompletion(): disabled
15:49:03,644 INFO SettingsFactory:129 - Automatic session close at end of transaction: disabled
15:49:03,645 INFO SettingsFactory:136 - JDBC batch size: 15
15:49:03,645 INFO SettingsFactory:139 - JDBC batch updates for versioned data: disabled
15:49:03,647 INFO SettingsFactory:144 - Scrollable result sets: enabled
15:49:03,648 INFO SettingsFactory:152 - JDBC3 getGeneratedKeys(): disabled
15:49:03,648 INFO SettingsFactory:160 - Connection release mode: auto
15:49:03,650 INFO SettingsFactory:187 - Default batch fetch size: 1
15:49:03,651 INFO SettingsFactory:191 - Generate SQL with comments: disabled
15:49:03,651 INFO SettingsFactory:195 - Order SQL updates by primary key: disabled
15:49:03,652 INFO SettingsFactory:338 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
15:49:03,655 INFO ASTQueryTranslatorFactory:21 - Using ASTQueryTranslatorFactory
15:49:03,656 INFO SettingsFactory:203 - Query language substitutions: {}
15:49:03,657 INFO SettingsFactory:209 - Second-level cache: enabled
15:49:03,658 INFO SettingsFactory:213 - Query cache: disabled
15:49:03,658 INFO SettingsFactory:325 - Cache provider: org.hibernate.cache.EhCacheProvider
15:49:03,669 INFO SettingsFactory:228 - Optimize cache for minimal puts: disabled
15:49:03,670 INFO SettingsFactory:237 - Structured second-level cache entries: disabled
15:49:03,676 INFO SettingsFactory:257 - Echoing all SQL to stdout
15:49:03,677 INFO SettingsFactory:264 - Statistics: enabled
15:49:03,678 INFO SettingsFactory:268 - Deleted entity synthetic identifier rollback: disabled
15:49:03,679 INFO SettingsFactory:283 - Default entity-mode: pojo
15:49:03,715 INFO SessionFactoryImpl:153 - building session factory
15:49:03,749 WARN Configurator:126 - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/home/lucas/workspace/Autobahn1.5/lib/Hibernate/ehcache-1.1.jar!/ehcache-failsafe.xml
15:49:14,824 INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured
15:49:14,824 INFO SessionFactoryImpl:353 - Checking 0 named HQL queries
15:49:14,825 INFO SessionFactoryImpl:373 - Checking 0 named SQL queries
Opening new Session for this thread.
My computer is a Athlon64 3.0, with 512mb RAM runnig Suse Linux 10.0 as main OS.
Please correct me if I'm wrong: it seems that the ehCache Configuration is taking too long (11 seconds). Could this be the main problem? Is a good initialization time?
many thanks!