Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session bean implements more than one interfaces

 
Grace Yang
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pubic interface Bar{ public void bar() ; }

@Stateful
public class MyBar implements Serialable, Bar
{
public void bar(){..};
}
Question 1:
MyBar is wrong, because when implementing more than one interface, it can't not implement Serialable, am I correct?

But can I define as below? (only implemnt one interface.)
@Stateful
public class MyBar implements Serialable
{


}

Thanks


Thanks
 
Vinay Nath
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not wrong, when implementing multiple interfaces, serializable and externizable are not counted.

look at this text:

A bean class is permitted to have MORE THAN ONE interface. If a
bean class has more than one interface excluding the
interfaces listed below any business interface of the bean
class MUST be explicitly designated as a business interface of the
bean by means of the Local or Remote annotation on the bean
class or interface or in the deployment descriptor.

and also:

The following interfaces are excluded when determining whether
the bean class has more than one interface: java.io.Serializable;
java.io.Externalizable; any of the interfaces defined by the javax.ejb
package.
 
Grace Yang
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks again Vinay !
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic