• 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

sessionSynchronization

 
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why can't statless bens implement sessionSynchronization?

Can BMT Session beans implement sessionSynchronization? It would be pointless but can they?

Can EntityBeans implement sessionSynchronization?
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Kris Reid:
Why can't statless bens implement sessionSynchronization?
Can BMT Session beans implement sessionSynchronization? It would be pointless but can they?
Can EntityBeans implement sessionSynchronization?


1.) Stateless beans cannot implement sessionSynchronization because transactions in stateless session beans are not allowed to span multiple method calls. As soon as a method returns, the transaction is over. Begin/Commit is governed by the scope of the method. There is no more sense to call the sessionSynchronization methods.
2.) They can (im not sure) but might not be called by the container since it expects the bean provider to explicitly call begin and commit.
3.) Entitiy beans have onLoad() and onStore() methods instead of the sessionSynchronization methods. I'm not sure if implementing is legal. I doubt it.
 
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Why can't stateless beans implement SessionSynchronization?


By allowing stateless session beans to implement SessionSynchronization, we're actually implying that session beans can maintain state across transactions, which is not true. Hence, it is not allowed.

Can BMT Session beans implement SessionSynchronization? It would be pointless but can they?


You can't. Because by having BMT, you know exactly when you're starting & ending the transactions. The exact boundaries of the transactions are made known to you. Hence, you don't have to rely on implementing the SessionSynchronization interface.

Can EntityBeans implement SessionSynchronization?


As of EJB 2.0, entity beans can only be of CMT type. As pointed out by Paul, you've the benefits of ejbLoad & ejbStore. Also, the name of the interface sortof indicated that its meant for session beans only.
reply
    Bookmark Topic Watch Topic
  • New Topic