• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Mock question about business interfaces

 
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

Which are valid declarations for a Local business interface?
public interface Foo1 {
public void foo();
}

import javax.ejb.Local;
@Local
public interface Foo2 {
public void foo();
}

import javax.ejb.*;
@Local
public interface Foo3 extends EJBLocalObject {
public void foo();
}

import javax.ejb.*;
@Local
@Remote
public interface Foo4 {
public void foo();
}

A. Foo1, Foo2, Foo3
B. All of the above
C. Foo2
D. Foo1, Foo2

---------
ANSWER:

Foo1 is valid. There is no requirement that the interface be annotated with @Local.

Foo2 is valid. The @Local annotation may be used to directly annotate the interface.

Foo3 is invalid because a Local business interface must not extend javax.ejb.EJBLocalObject. EJBLocalObject is only used for EJB 2.x style Local interfaces.

Foo4 is invalid because a single business interface can not be both a Remote business interface and a Local business interface. This would be very dangerous since the interface would appear to be the same but would have different calling semantics(pass-by-value vs. pass-by-reference) depending on how it was used.



I have a doubt with Foo3.
The spec 4.6.6 says:

The interface must not extend the javax.ejb.EJBObject or javax.ejb.EJBLocalObject interface.



But my OC4J run without error.

What the expected result of defining a local business interface that extends javax.ejb.EJBLocalObject ?

Thanks,

Beno�t
 
I didn't like the taste of tongue and it didn't like the taste of me. I will now try this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic