The EJB container generates stubs using RMI-IIOP - this means that the developer writing the code writes regular RMI interfaces (or EJB interfaces in this case), but when stubs are generated, the implementation of the stubs "talk" using IIOP - the same protocol that CORBA uses. I'm not completely sure that there's a "real" CORBA ORB running the RMI-IIOP stubs - the Java RMI system could be enough of an "ORB" for this - or maybe the application server comes with a "real" ORB - in this case it would then know the specific ORB it was going to use.
As far as when to use RMI, when to use IDL, and when to use RMI-IIOP - there's a section on that in the RMI over IIOP Documentation provided by Sun.
The reason that you have to use RMI-IIOP in EJB is simple - it's a required part of the EJB spec.
Thanks! and welcome to the JavaRanch! [ August 09, 2005: Message edited by: Nathan Pruett ]
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Here is another piece of advice. If you already have IDL files for an existing CORBA application, using Java-IDL is a good idea since it generates the appropriate Java interfaces for the IDL. If you want to, you can implement the interfaces using RMI-IIOP or EJB depending on the needs of your application.