These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Autocommit, MultiTableUpdateExecutor, and Sybase
PostPosted: Wed Apr 25, 2007 12:18 pm 
Newbie

Joined: Tue Feb 27, 2007 12:31 pm
Posts: 8
Location: nyc
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>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 25, 2007 1:33 pm 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
Where and how do you handle your transactions?...

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 25, 2007 2:58 pm 
Newbie

Joined: Tue Feb 27, 2007 12:31 pm
Posts: 8
Location: nyc
transactions are handled by springs transactional proxy been. when autocommit was enabled, we had some methods are where non-transacted (but only a handful). when we disabled autocommit, we set all methods be transactions uing PROPAGATION_REQUIRED as the propogation and what ever the default isolation level is.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 25, 2007 3:59 pm 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
Autocommit should never be used. I guess that your performance problem is due to the rollback segment that your db has to manage.

Maybe your methods are managing lots of data, if so it could be an explanation (need of a big rollback segment).

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.