tknerr/sample-ejb-app — pull request #2 by tknerr (2014-04-23 10:07:01+00:00)
Title: Remote jndi lookup

Testing different variations of `@Remote` / `@Local` interface views (see commit history for the whole story)

The sweet spot is to use this pattern:
```java
@javax.ejb.Local
public interface Coffee {

@javax.ejb.Remote
interface Remote extends Coffee {}

String drink();
}
```

This ensures that by default the local interface is used when injected via `@EJB` but allows you to specify the remote interface as well, if desired:
```java
@Stateless
public class CoffeeFacadeBean implements CoffeeFacade, CoffeeFacade.Remote {

@EJB
private Coffee localCoffee;

@EJB(beanInterface = Coffee.Remote.class)
private Coffee remoteCoffee;

...
```

Note that both `@Local` and `@Remote` on the same interface is illegal as per EJB spec. Altough Glassfish does not complain at deployment time, it will fail during runtime with a Serialization error (reason is that you will get the local bean as per jndi lookup).

Inspired by:
* http://www.coderanch.com/t/163182/java-EJB-SCBCD/certification/EJB-Providing-Remote-local-views
* http://piotrnowicki.com/2013/03/defining-ejb-3-1-views-local-remote-no-interface/
* http://www.adam-bien.com/roller/abien/entry/beans_with_both_views_local