Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can I override session bean type in the deployment descriptor?

 
Mellon Sun
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For instance, there is a stateless session bean annotated with "@Stateless", can I override it to a stateful session bean via the deployment descriptor?

"Type-level, method-level, and field-level annotation can all be overridden by the deployment descriptor.", is this true?
 
Mellon Sun
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<enterprise-beans>
<session>
<ejb-name>StatelessSBBean</ejb-name>
<ejb-class>com.mellon.StatelessSBBean</ejb-class>
<session-type>Stateful</session-type>
</session>
</enterprise-beans>

It works with the descriptor snippet above, the StatelessSBBean is annotated with @Stateless, how could I confirm the StatelessSBBean is running as an Stateful Session Bean exactly? After all, there is not a
method like "isStateless" or "getSessionType" exists.

And, anyone can cite a case need this?
 
Manish Shah
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No.

Not all annotations are overridable.

Session bean types like @Stateful or @Stateless cant be overridden via a descriptor.
 
Jeya Uma
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you refer Mikalai Zaikin notes , you can find the following notes in Chapter 1

" Keep in mind not all annotations are overridable
e.g., Session bean type (Stateful vs. Stateless) can't be overridden"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic