You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Bengt Rodehav <be...@rodehav.com> on 2011/12/14 08:20:41 UTC

How to configure transaction timeout?

I use Aries JPA and Aries Transaction with OpenJpa. I have problems with
some long transactions that time out (I think anyway). I cannot see where I
can configure the transaction timeout for Aries Transaction. The only
interaction I have with Aries Transaction is my blueprint definition where
I create beans with transaction properties set and publish them as
services. Below is an example of one of my blueprint definitions.

Can anyone advice me as to how one can configure the transacation timeout?
(and what is the default?)

I originally posted this on the aries list but I'm hoping that someone
using OpenJPA might have encountered this problem.

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:tx="
http://aries.apache.org/xmlns/transactions/v1.0.0"
  xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0">

  <bean id="statementService"
class="se.digia.skistory.domain.impl.StatementService">
    <tx:transaction method="*" value="Required" />
    <jpa:context property="entityManager" unitname="skistPU" />
  </bean>

  <service ref="statementService"
interface="se.digia.skistory.domain.api.IStatementService">
  </service>

  <bean id="customerService"
class="se.digia.skistory.domain.impl.CustomerService">
    <tx:transaction method="*" value="Required" />
    <jpa:context property="entityManager" unitname="skistPU" />
  </bean>

  <service ref="customerService"
interface="se.digia.skistory.domain.api.ICustomerService">
  </service>

</blueprint>


/Bengt

Re: How to configure transaction timeout?

Posted by Pinaki Poddar <pp...@apache.org>.
> they will still cause the transaction to fail - right? 
right (assuming JPA transaction is enlisted in Aries transaction manager's
global transaction).

> Often the most difficult refactoring is also the most necessary... 
It is bane of our time that we tend to prefer what is urgent rather than
what is important.  

-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: http://openjpa.208410.n2.nabble.com/How-to-configure-transaction-timeout-tp7092641p7117020.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: How to configure transaction timeout?

Posted by Bengt Rodehav <be...@rodehav.com>.
Thanks for your advice Pinaki - will try it.

I guess though that these timeouts will not affect aries-jta's transaction
timeout but they will still cause the transaction to fail - right?

Yes, I read on this list that the classloading refactoring wasn't
successful. Looking forward to a new attempt. Often the most difficult
refactoring is also the most necessary...

/Bengt

2011/12/21 Pinaki Poddar <pp...@apache.org>

> Hi Bengt,
>  One way will be to set timeouts of lock and query in persistence.xml.
>
>    <property name="openjpa.LockTimeout" value="30000"/>
>    <property name="openjpa.ConnectionFactoryProperties"
> value="QueryTimeout=5000"/>
>
>  It is also possible to set these timeouts for individual query (passing
> them as query hints) or explicit locking via em.lock(...) API calls.
>
> PS: I know I have not solved the Auditor classloading in OSGi environment.
> Actually a large experiment to do that failed. I will make another attempt
> to solve it within a smaller scope.
>
>
> -----
> Pinaki Poddar
> Chair, Apache OpenJPA Project
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/How-to-configure-transaction-timeout-tp7092641p7115968.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Re: How to configure transaction timeout?

Posted by Pinaki Poddar <pp...@apache.org>.
Hi Bengt,
  One way will be to set timeouts of lock and query in persistence.xml. 

    <property name="openjpa.LockTimeout" value="30000"/>
    <property name="openjpa.ConnectionFactoryProperties"
value="QueryTimeout=5000"/>

  It is also possible to set these timeouts for individual query (passing
them as query hints) or explicit locking via em.lock(...) API calls.

PS: I know I have not solved the Auditor classloading in OSGi environment.
Actually a large experiment to do that failed. I will make another attempt
to solve it within a smaller scope.
 

-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: http://openjpa.208410.n2.nabble.com/How-to-configure-transaction-timeout-tp7092641p7115968.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.