I have a wierd problem
When a user logs into my system, the first time, it takes a long time for the user to be authenticated and provided access. Upon getting access, subsequently if he logs out and tries to login, the access is very fast.
I enabled all logs for hibernate and i see where time is being consumed. The log is as below
2008-02-04 17:35:52,921 DEBUG [org.hibernate.type.StringType] - binding 'admin' to parameter: 1
2008-02-04 17:36:01,625 DEBUG [org.hibernate.jdbc.AbstractBatcher] - about to open ResultSet (open ResultSets: 0, globally: 0)
As you can see it took approximately 9 seconds from the time the prepared statements values are bound and the result set is available..it is a very simple query which takes 9 seconds. The same query on toad takes milliseconds. Why? Subsequently if i login and logout, the time difference for the exact same thing is less than a second. I dont understand why..
I have spring, hibernate and Oracle10G database. I am listing below my hibernate settings..
<property name="hibernateProperties">
<props>
<prop key="show_sql">true</prop>
<prop key="hibernate.generate_statistics">true</prop>
<prop key="hibernate.cglib.use_reflection_optimizer">false</prop>
<prop key="hibernate.max_fetch_depth">3</prop>
<prop key="hibernate.jdbc.fetch_size">500</prop>
<prop key="hibernate.jdbc.batch_size">10</prop>
<prop key="hibernate.cache.use_second_level_cache"> false</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
</props>
</property>
i am using c3po for DB Pooling. The settings are as below
<bean id="dataSource"
class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass">
<value>${driverClassName}</value>
</property>
<property name="jdbcUrl">
<value>${url}</value>
</property>
<property name="properties">
<props>
<prop key="c3p0.acquire_increment">5</prop>
<prop key="c3p0.idle_test_period">100</prop>
<prop key="c3p0.max_size">100</prop>
<prop key="c3p0.max_statements">0</prop>
<prop key="c3p0.min_size">20</prop>
<prop key="user">${username}</prop>
<prop key="password">${password}</prop>
</props>
</property>
</bean>
And finally the hibernate mapping file i have which works with this problem is below
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.ebizformedia.model.AppUser" table="ebiz.APP_USER" entity-name="ENT_APP_USER">
<id name="userId" column="USER_ID" type="long" unsaved-value="0" >
<generator class="sequence">
<param name="sequence">ebiz.S_APP_USER</param>
</generator>
</id>
<property name="userName" column="USER_NAME" type="string" not-null="true"/>
<property name="password" column="USER_PASSWORD" type="string" not-null="true"/>
<property name="certData" column="CERT_DATA" type="string" not-null="true"/>
<property name="salt" column="SALT" type="string" not-null="true"/>
<many-to-one name="status" column="STATUS" class="com.ebizformedia.model.LookupRef"
entity-name="ENT_LOOKUP_REF" not-null="false" lazy="false" />
<property name="insertDate" column="dtInsertDate" type="calendar" not-null="false"/>
<property name="insertBy" column="vchInsertBy" type="string" not-null="false"/>
<property name="updateDate" column="DTUPDATEDATE" type="calendar" not-null="true"/>
<property name="updateBy" column="VCHUPDATEBY" type="string" not-null="true"/>
<many-to-one name="contact" column="contact_id" entity-name="ENT_CONTACT" class="com.ebizformedia.model.Contact" not-null="false"/>
</class>
</hibernate-mapping>
Thanks For all the help..
|