InitialContext initial = new InitialContext();
UserTransaction transaction = (UserTransaction) 
initial.lookup("java:comp/UserTransaction");

YourSessionAhome homeA = (YourSessionAHome) 
javax.rmi.PortableRemoteObject.narrow(initial.lookup("java:comp/env/ejb/SampleA"), 
YourSessionAHome.class);
YourSessionA yourSessionA = homeA.create();

YourSessionBHome homeB = (YourSessionBHome) 
javax.rmi.PortableObject.narrow(initial.lookup("java:comp/env/ejb/SampleB"),YourSessionBHome.class);
YourSessionBHome yourSessionB = homeB.create();

try{
    transaction.begin();
    yourSessionA.someMethod();
    yourSessionB.someMethod();
    transaction.commit();
}
catch(Exception ex){
    ex.printStackTrace;
}

public class YourSessionA implements SessionBean {
    public void someMethod(){
        System.out.println("Hope This Helps.");
    }

    // ... callbacks etc.
}

public class YourSessionB implements SessionBean{

    public void someMethod(){
         System.out.println("From mrgarageman.");
    }
    // .. callback etc.
}

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

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


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to