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

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

Here's my SFSB code. Method incrCounterWithUserTx() is defined as UNSUPPORTED wrt tx 
support in ejb-jar.xml.



This works for me with both LOCAL, REPL_ASYNC and REPL_SYNC cache modes. Although I 
found another bug with REPL_SYNC, which I'm working on now.



    public int incrCounterWithUserTransaction() {

        Integer counter=null;

        UserTransaction tx=null;



        try {

            // tx=ctx.getUserTransaction();

            tx=(UserTransaction)new InitialContext().lookup("UserTransaction");

            tx.begin();



            counter=(Integer)cache.get("/bela/ban", "counter");

            if(counter == null) {

                counter=new Integer(0);

            }

            else {

                counter=new Integer(counter.intValue() +1);

            }

            cache.put("/bela/ban", "counter", counter);

            tx.commit();

        }

        catch(Exception e) {

            e.printStackTrace();

            try {

                if(tx != null)

                    tx.rollback();

            }

            catch(SystemException e1) {

                e1.printStackTrace();

            }

        }



        return counter != null? counter.intValue() : -1;

    }


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to