>From what you post, it does not look like the caller is in a transaction.

This causes:
agent = home.findByPrimaryKey( new AgentPK(id) ); //to start and complete a new 
transaction for the call

eaf.setId( agent.getId() );//to start and complete a new transaction for the call
   :
Collection engines = agent.getSearchEngines();//to start and complete a new 
transaction for the call



If the caller is in a a Tx, all the entity bean methods will be executed as part of 
the existing Tx. The most common way to acheive this is to have your struts Action 
call a SSB (Session Facade) that has trans-attribute=Required, and to use a data 
transfer object to pass the values from the facade back to the caller.

An alternative would be to manage the transactions yourself by using User 
transactions, along the lines of:

UserTransaction tx = null;
try
{
        InitialContext ctx = new InitialContext();
        tx = (UserTransaction) ctx.lookup("UserTransaction");
        tx.begin();


        //Do your stuff

        if (tx.getStatus() == Status.STATUS_ACTIVE)
        {
                tx.commit();
        }
        return table;
}
catch (Exception e)
{
        if (tx != null) tx.rollback();
}




                                 

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3841226#3841226

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3841226


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to