Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Local and Remote annotations  RSS feed

 
Kathiresan Chinna
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

Consider the declarations

@Remote
public interface I1

@Local
public interface I2

@Stateful
public class CartBean implements I1, I2

Is it possible ?
if so, what is the CartBean type local or remote ?

Thanks
Kathiresan



 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kathiresan,

this is absolutely legal in EJB 3. Your bean class may implement both, a remote and and a local interface just like a regular Java class can implement multiple interfaces. So it can act like I2 or/and I1 at the same time. Of course only the methods declared in I1 are available for remote calls then.

Marco


 
Kathiresan Chinna
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Marco

Kathir
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome

Besides as an advice from my personal experience I can only recommend you to try such examples in practice by making little example projects. Although I don't have a SCBCD certification I learned the most about EJB by experimenting to see how things work. Often you'll remember this better than by only reading books without any practical experiences. A modern IDE like NetBeans makes the deployment of enterprise applications very easy so you can concentrate only on problems in your code just like with your example.

Marco
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!