Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.1.0
Mapping documents:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-lazy="false" default-cascade="save-update">
<class abstract="true" name="com.fds.ObjectIdentity">
<cache usage="read-write"/>
<id unsaved-value="-1" access="property" name="id">
<generator class="native"/>
</id>
<property name="fdsMasterId" not-null="true" access="property"/>
<property name="name" not-null="true" access="property"/>
<property name="creationDate" access="property"/>
<property name="rn" access="property"/>
<property name="source" not-null="true" access="property"/>
<joined-subclass name="com.fds.white.FundClass" table="FundClass">
<key/>
<set access="property" lazy="true" inverse="true" cascade="all" name="series">
<key column="fundClass"/>
<one-to-many class="com.fds.white.Series"/>
</set>
<many-to-one not-null="false" column="parentFund" lazy="proxy" access="property" name="parentFund"/>
<many-to-one not-null="false" column="parentSidePocket" lazy="proxy" access="property" name="parentSidePocket"/>
<property name="currency" access="property"/>
<many-to-one not-null="false" column="roll_to_series" lazy="false" access="property" name="rollToSeries"/>
<property name="hotPL" access="property"/>
<property name="longName" access="property"/>
<property name="externalID" access="property"/>
<one-to-one name="feeParameters" cascade="all" property-ref="parentFC" access="property"/>
<one-to-one name="termParameters" cascade="all" property-ref="parentFC" access="property"/>
<set access="property" lazy="true" sort="natural" cascade="all,delete-orphan" order-by="date asc" name="returns">
<key column="classId"/>
<one-to-many class="com.fds.white.ReturnDataPoint"/>
</set>
</joined-subclass>
</class>
</hibernate-mapping>
Name and version of the database you are using: Sybase 12.0
Code between sessionFactory.openSession() and session.close():
Query q = sess.createQuery("UPDATE FundClass fc SET fc.name=? WHERE fc.id=?");
if(arg1!=null)
q.setParameter(0, arg1);
if(arg2!=null)
q.setParameter(1, arg2);
q.executeUpdate();
When running with autocommit not explicitly set to false, the above statement will fail. This is because hibernate is creating a 'mini' transaction for this statement, and this statement is a multi-table update. Therefore, hibernate is attempting to create a temp table for the update within a transaction, which Sybase does not allow.
That problem is easy enough to rectify by simply setting autocommit to false. However, when we do, the performance of my application drops, drastically, by serveral thousand percent. Has anyone else seen this behavior?
I am using Spring 1.2.6 as a wrapper around hibernate if that matters. here is my hibernate config:
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SybaseDialect</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="hibernate.connection.provider_class">com.fds.hibernate.DBCPDataSource</prop>
<prop key="hibernate.connection.autocommit">false</prop>
<prop key="hibernate.connection.release_mode">on_close</prop>
<prop key="hibernate.dbcp.defaultAutoCommit">false</prop>
<prop key="hibernate.dbcp.initialSize">5</prop>
<prop key="hibernate.dbcp.maxActive">20</prop>
<prop key="hibernate.dbcp.maxIdle">5</prop>
<prop key="hibernate.dbcp.removeAbandoned">true</prop>
<prop key="hibernate.dbcp.logAbandoned">true</prop>
<prop key="hibernate.dbcp.whenExhaustedAction">2</prop>
<prop key="hibernate.dbcp.ps.maxActive">20</prop>
<prop key="hibernate.dbcp.ps.maxWait">12000</prop>
<prop key="hibernate.dbcp.ps.maxIdle">5</prop>
<prop key="hibernate.dbcp.ps.whenExhaustedAction">2</prop>
<prop key="hibernate.jdbc.use_getGeneratedKeys">true</prop>
</props>
</property>