Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can an EJB bean implement multiple interfaces?

Can an EJB bean implement multiple user defined interfaces, except business interfaces (@Local, @Remote) or No-Interface view (@LocalBean)?

For example define two interfaces UserInterface1, UserInterface2, with no annotation.

Is this legal to implement:

@Stateless
public class MyBean implements UserInterface1, UserInterface2 { ...

Then I have another confusion:

@Stateless
public class MyBean implements Runnable { ...
//inside I won't try to manage thread
}

Is this legal or illegal, I found that glassfish support this situation.

like image 574
user1684651 Avatar asked Dec 21 '12 07:12

user1684651


1 Answers

The given example is illegal, but nevertheless accepted by quite some implementations (application servers).

David Blevins started a thread about this on the EJB mailing list a while ago.

EJB 3.2 will make the rules more clear for this topic. See What's new in EJB 3.2 ? - Java EE 7 chugging along! (look for section Simplified the rules to define all local/remote views of the bean)

like image 129
Arjan Tijms Avatar answered Sep 29 '22 22:09

Arjan Tijms