Here is a brief explanation of why certain transaction attributes are disallowed. Entity beans and stateful session beans with SessionSynchronization must use transactions. The reason is that both of these types of beans are inherently transactional in nature. Entity beans perform database updates, and stateful session beans with SessionSynchronization (which we describe later in this chapter) are also transactional. Therefore you normally can't use the following attributes: Never, NotSupported, Supports. Note that the EJB specification does allow for containers to optionally support these attributes for stateful session beans and entity beans—but only if you're using non-transactional data stores—and with the warning that if you use this, your beans will not be portable, and you may find that you receive inconsistent results.
A client does not call a message-driven bean directly; rather, message-driven beans read messages off a message queue in transactions separate from the client's transaction. There is no client, and therefore transaction attributes that deal with the notion of a client's transaction make no sense for message-driven beans—namely Never, Supports, RequiresNew, and Mandatory.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment