I know this is not the Seam forum, but much of the problem is related to
hibernate,jboss.
I've horrable problems getting into the seam forum, and as I format the
text i get ejected or the tesulting text is simply not accepted
BMT Transactions
general remak:>
I've got a problem with BMT transactions in Seam, I's huge and very confusing since
I find hardly any clarifying doc and everyone has his personal addaption, where no one can know the changed behaviour is due to the added layer or the original software. Layers shielding away the reality so that its get difficult to chose the right option.
the real problem>
TXN seams to FAIL completely, or better said it seems to react completely irrational. Its my suspicion something is wrong with the injection of the entity manager.
As I try to use transactions using seam in the simplest test Form, (see the code (D)) it seems to work,As I try transactions inline of a single seam bean it seems to work.
As I call the same bean from the first bean injection on itself succeeds but the transcations CAN NOT JOIN.
[list=]As I call the bean from Quartz injection suceeds but the transaction CAN NOT JOIN
.
I tried the code placed at the end (d) in different connections
call bean --> call bean ---> call bean---> sometimes it works sometime it does not
(no transaction active or No active JTA transaction) at erratic levels
Can some order been seen in that behavior ?
Any help is welcome, Applications without transactions are useless.
As i'm trying to be modular, testing a bean in one mode, connecting it at an other level,
It is worriing to see the transactions fail depending on the level called .
------------------------------Problem-------------------------------
I fail on No active JTA transaction on joinTransaction call(before txn start), or no transaction active errors (flushPersist)
depending on where I allow the code to fail.
As I found the problem is reproducable using the simple code
Code:
try{ em.joinTransaction(); }catch (Exception er) {->No active JTA transaction on joinTransaction }
I use this code to detect any hope of being able to do transactions.
I tried diferent situations
Html-Submit --> join works
Html-submit --> Other Seam bean ---> Fails
Html-submit --> Other Seam bean--> Other Seam bean--> Other Seam bean ---> Succes
Jboss-Startup->Create --> Quartz --> FAILS
-----------Environment-----------jboss seam 1... 2.01GA--------------------------------------
a) I want to execute 1000's of transactions all completely independent but with internal
rollback if induvidual transactions fail for any reason.
So CMT and Seam transactions are out of the question.
I need BMT.
b) I want to be able to execute interactive and sheduled in batch (QUARTZ)
I preference even using the same bean code.
c) Isolved (apearently) the txn Timeout problem
using
Code:
@org.jboss.annotation.ejb.TransactionTimeout(9000)
try{ userTransaction.setTransactionTimeout(100000); }
catch (Exception er) {ER(er,"transaction timeout ");}
This seams to FAIL completely, or better said it seems to react completely irrational.
I use
Code:
Components.xml
<core:init debug="@debug@" jndi-pattern="@jndiPattern@" transaction-management-enabled="false"/>
<!-- <transaction:no-transaction />
<transaction:no-transaction />
(remark I see hardly any difference on changing the above settings]
d) used test code
Code:
@Stateful
@Name("txn0")
@Scope (ScopeType.CONVERSATION)
@TransactionManagement(TransactionManagementType.BEAN) //tried different combinations no big difference
@org.jboss.annotation.ejb.TransactionTimeout(9000) //tried different combinations no big difference
@TransactionAttribute(TransactionAttributeType.SUPPORTS) //tried different combinations no big difference
public class txntest extends txntestINTF {
@Logger private Log log;
@In FacesMessages facesMessages;
@PersistenceContext (type=EXTENDED) public EntityManager em;
@In (create=true) txn1testINTF txn1; <<<< Just call a copy of this code
@Resource public UserTransaction userTransaction;
private String value;
String level=" Submit";
String Env ="txn0 ";
public void test()
{ try{ em.joinTransaction(); }catch (Exception er) <<<<Success first later beans fail
{ Env+=" NO JTA Transaction active ??? ";
String errmsg=er.getClass().getSimpleName() +" err: "+ er.getMessage();
}
txn1.test();<<< Fails on call as a separate Bean
log.info("test.test() action called with: "+Env); <<<< call the exact copy using SEAM beans
facesMessages.add("test #{test.value}");
}
//add additional action methods
@Destroy @Remove
public void destroy() {}
}
-------------------------------------------------------------------------------------------