This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Need to know the implementation details of ejbRemove(), ejbActivate for EJB 3.1 exam?

 
Himai Minh
Ranch Hand
Posts: 1393
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On p.20 of Frits notes, it says
"The optional SessionBean interface (needed in earlier EJB version) defines 4 methods setSessionContext, ejbRemove..... If the Session bean implements the optional SessionBean
interface and uses the annotations:
@PreDestroy can only be applied on the ejbRemove() method ...."

For EJB 3.1 exam, do we need to know the details of how to implement ejbRemove(), ejbPassivate() , ejbActivate() and setSessionContext() ?

I know in EJB 2.0, we need to provide implementations for these 4 methods when a bean implements SessionBean interface. To my understanding, in EJB 2.0, the developer even needs to set values for transient variables in a Serializable object inside the ejbActivate() method.


 
andrew sydor
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, on the EJB3.1 exam is without EJB2.0 technology.
So you don't need know anything about this methods.

But in EJB3.1 we have interface @PostConstruct, @PreDestroy ... which I can say they are similar.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2777
172
Android Chrome Eclipse IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
andrew sydor wrote:No, on the EJB3.1 exam is without EJB2.0 technology.
So you don't need know anything about this methods.

Correct.

I only added this small part as it can be confusing when you let your "new" EJB implement the "old" SessionBean interface. It is possible but you need to be aware that the "new" annotations (e.g. @PreDestroy) can only be place on specific "old" methods (e.g. ejbRemove)
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!