TigerCoder
TigerCoder

Reputation: 67

Finish work on EJB3 even after timeout

I am designing webservices for an order system. When I have receive a order, it hast to add around 10000 entities in a table. It can be more. But as I am understanding this work will not finished in transaction time and will get timeout and all the works will be role back. But I want the service to finish it's work even after transaction time has past. How can I achive that? We are using EJB3 in WebLogic 11g with jdk 1.6.25.

Upvotes: 0

Views: 154

Answers (3)

SridharS
SridharS

Reputation: 923

If consistency is not a problem and it's checked elsewhere then you should update the database records outside of ttransaction scope. So save what needs to go to db in a place where its quick. And let the actual db insertion happen in a non transacted session later on.

Upvotes: 0

Acharya
Acharya

Reputation: 97

Try JMS with MDB for long running processes.

Upvotes: 0

A. A. Vybegallo
A. A. Vybegallo

Reputation: 246

You can set transaction timeout: Services -> JTA, set the Timeout Seconds param value. By default this value is 30 seconds.

If your transactions is very long may be you have change your app architecture. You can insert rows without transactions (but you can lost your data consistency) or use butch update with one portion of data per transaction.

For insert rows without transaction you can use @TranscactionAttribute with TransactionAttributeType.NOT_SUPPORTED.

Upvotes: 1

Related Questions