Hibernate version: 3.2.6
Spring version: 2.5.4
Code
Code:
public void updateFile(FileBean file){
try {
getHibernateTemplate().update(file);
log.info(file.getFileID() + " updated. Status is " + file.getStatusID());
} catch (Exception e) {
log.error("Error updating file " + file.getFileID(),e);
}
}
Name and version of the database you are using: MS SQL Server 2000
I'm using the latest hibernate on the latest Spring, with c3p0 as the pool. I have a multi-threaded app that performs a lot of updates using the method above (updateFile).
99.9% of the time, this works flawlessly. You can see that I'm not doing any transaction handling at all...
In a nutshell, what happens intermittently is that update() gets called but the DB doesnt' actually get updated. for example, let's say the FileBean object has a StatusID of 4. it gets passed into update, update() runs, log.info says that the status is 4 (I can see this in the logs), but the DB doesn't reflect that new statusid.
I've been staring at this for two days, trying everything I know how to do in terms of debugging, but I can't figure it out. The darn thing just disappears into space and I don't see any errors anywhere.
As I said, it's intermittent. And it seems to manifest more on a faster machine than a slower machine, for what it's worth.
it feels like a deadlock problem on the update, but I'd expect to get some errors if that were the case, but I don't. I do have deadlock problems in general that I'm still trying to figure out, but even the other methods that exhibit the deadlock problems do in fact throw the appropriate errors.
So basically I'm appealing for any advice on figuring out why the updates are going into the ether without a word.
Quite possibly it's a problem with using a singleton DAO in a multi-threaded app without any transaction handling. But even when I put the dao to be a non-singleton the behavior persists.
possibly it's some setting I need to set that I'm not setting. Possibly it's something else. I'm really quite perplexed at this point.
I'll post the config stuff at the bottom.
Thank you thank you thank you for any advice!
Best,
marc
Hibernate config inside of spring:
Code:
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="net.sourceforge.jtds.jdbc.Driver"/>
<property name="jdbcUrl" value="${jdbc.connectstring}"/>
<property name="user" value="${jdbc.user}"/>
<property name="password" value="${jdbc.password}"/>
<property name="acquireRetryDelay" value="2000"/>
<property name="maxPoolSize" value="200"/>
<property name="maxIdleTime" value="60"/>
<property name="maxStatements" value="0"/>
<property name="maxStatementsPerConnection" value="100"/>
<property name="testConnectionOnCheckin" value="true"/>
<property name="acquireRetryAttempts" value="5"/>
<property name="preferredTestQuery">
<value>Select 'This is the connection tester DOH applicationContext.xml Connection Pool'</value>
</property>
</bean>
<!-- HIBERNATE CONFIGURATION -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<!-- PUT ALL HIBERNATE MAPPING FILES HERE!!! -->
<property name="mappingResources">
<list>
<value>com/argus/doh/db/RequestStatusBean.hbm.xml</value>
<value>com/argus/doh/db/FileBean.hbm.xml</value>
<value>com/argus/doh/db/ManagerStatusBean.hbm.xml</value>
<value>com/argus/doh/db/ServerBean.hbm.xml</value>
<value>com/argus/doh/db/EnvironmentBean.hbm.xml</value>
<value>com/argus/doh/db/AppLocationBean.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<!-- Session context management -->
<prop key="current_session_context_class">thread</prop>
<!-- Disable 2nd level cache -->
<prop key="cache.provider_class">org.hibernate.cache.NoCacheProvider</prop>
<!-- Echo all sql to stdout; useful for debugging -->
<prop key="show_sql">true</prop>
<prop key="hibernate.c3p0.max_statements">0</prop>
</props>
</property>
</bean>
<bean id="fileDAO" class="com.argus.doh.db.FileDAO" singleton="false">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>