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.  [ 3 posts ] 
Author Message
 Post subject: executeBatch hangs
PostPosted: Sat Jun 03, 2006 2:32 pm 
Newbie

Joined: Sun Dec 26, 2004 4:44 pm
Posts: 7
Location: Estonia
Hello folks,

I'm using hibernate 3.1.3 with oracle 10g and run into the problem that server hangs after call to PreparedStatement.executeBatch():

03.06.2006 09:28:08 DEBUG - AbstractEntityPersister - Inserting entity: [ru.hansaleasing.boffice.data.Domain#11]
03.06.2006 09:28:08 DEBUG - AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
03.06.2006 09:28:08 DEBUG - SQL - insert into DOMAIN (CODE, DESCRIPTION, ID) values (?, ?, ?)
Hibernate: insert into DOMAIN (CODE, DESCRIPTION, ID) values (?, ?, ?)
03.06.2006 09:28:08 DEBUG - AbstractBatcher - preparing statement
03.06.2006 09:28:08 DEBUG - AbstractEntityPersister - Dehydrating entity: [ru.hansaleasing.boffice.data.Domain#11]
03.06.2006 09:28:08 DEBUG - StringType - binding 'HELLs' to parameter: 1
03.06.2006 09:28:08 DEBUG - StringType - binding 'TERSEWa' to parameter: 2
03.06.2006 09:28:08 DEBUG - LongType - binding '11' to parameter: 3
03.06.2006 09:28:08 DEBUG - AbstractBatcher - Adding to batch
03.06.2006 09:28:08 DEBUG - AbstractBatcher - Executing batch size: 1

The problem appears on line 58 in org.hibernate.jdbc.BatchingBatcher.java where Hibernate is trying to executeBatch().

My Hibernate properties are described in Spring xml descriptor and are as follows:

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>ds/hlr</value>
</property>
</bean>


<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource"/>
</property>
<property name="mappingLocations">
<list>
<value>ru/hansaleasing/boffice/data/Domain.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.use_outer_join">true</prop>
</props>
</property>
</bean>


<!-- Hibernate interceptor wired into hibernate transaction manager -->
<!-- bean id="dataInterceptor" class="ee.soov.util.AuditInterceptor" singleton="false" /-->


<!-- Spring Hibernate transaction manager -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
<!-- property name="entityInterceptor">
<bean class="ru.hansaleasing.boffice.data.core.AuditInterceptor"></bean>
</property-->
</bean>


<!-- Dafault transaction configuration for services. -->
<bean id="abstractDefaultTxDefinition" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
abstract="true">

<property name="transactionManager">
<ref bean="transactionManager" />
</property>

<property name="transactionAttributes">
<props>
<prop key="*">
PROPAGATION_REQUIRED,ISOLATION_DEFAULT
</prop>
</props>
</property>
</bean>


<!-- Hibernate template for accessing hibernate from BO-s -->
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>


<!-- Default Hibernate template configuration for services. -->
<bean id="abstractHibTemplateDefinition" abstract="true">
<property name="template">
<ref bean="hibernateTemplate" />
</property>
</bean>


The class Domain is very simple:
/**
* @hibernate.class table="DOMAIN"
*/
public class Domain /*extends AuditableEntity*/ implements Serializable {
private static final long serialVersionUID = 1L;

/** identifier field */
private Long id;

/** persistent field */
private String code;

/** persistent field */
private String description;

/** default constructor */
public Domain() {
}

/**
* @hibernate.id generator-class="sequence" type="java.lang.Long" column="ID"
* @hibernate.generator-param name="sequence" value="S_DOMAIN"
*/
public Long getId() {
return this.id;
}

public void setId(Long id) {
this.id = id;
}

/**
* @hibernate.property column="CODE" length="50" not-null="true"
*/
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}

/**
* @hibernate.property column="DESCRIPTION" not-null="true"
*/
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
}


What do you think? Is there something that I miss?
Many thanks!

_________________
--------------------
wbr,
Vladimir


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 04, 2006 8:45 am 
Newbie

Joined: Wed Oct 06, 2004 2:49 am
Posts: 12
The fact that your code 'hangs' suggests it is waiting for a lock on the table/row in your database. Try stopping/starting your database, because your code/configuration looks ok.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 05, 2006 8:35 am 
Red Hat Associate
Red Hat Associate

Joined: Mon Aug 16, 2004 11:14 am
Posts: 253
Location: Raleigh, NC
I'm having the same issue, also on 10g. It happens when the data being updated is large-ish, i.e., >1k or so in VARCHAR2 columns in batch size >1. This isn't scientific, just something I've noticed.

When the problem occurs, I notice that the system lots many unrelated tables (though none blocking in my case). I'm still researching -- more to come as I find it. Setting hibernate.jdbc.batch_size=0 alleviates the problem.

Here's a little diagnostic info from my setup:

08:21:43,642 INFO [Environment] Hibernate 3.0.5
08:21:46,486 INFO [SettingsFactory] RDBMS: Oracle, version: Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - Production
With the Partitioning, OLAP and Data Mining options
08:21:46,486 INFO [SettingsFactory] JDBC driver: Oracle JDBC driver, version: 10.2.0.1.0
08:21:46,533 INFO [Dialect] Using dialect: org.hibernate.dialect.Oracle9Dialect

It is noteworthy that this happens to me on relatively new code -- I can reproduce it in my test environments but not in production. I do not know yet if this is a code problem or a difference in database config. Our prod database (not running new code yet) has different memory settings (larger SGA) so this may be a factor.

I'll be happy to collaborate on this with you offline so we don't spam the board with our discussion.

-Chris


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.