• Post Reply Bookmark Topic Watch Topic
  • New Topic

Transaction in EJB  RSS feed

 
PradeepPillai Pradeep
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The J2EE tutorial says,
"Session beans need the attributes defined for business methods, but do not allow
them for the create methods. Entity beans require transaction attributes for the
business, create, remove, and finder methods. Message-driven beans require
transaction attributes (either Required or NotSupported) for the onMessage
method."

But I don't get any error if I don't specify any transaction attributes. Can somebody explain why? May be there is a default transaction attribute?

Thank you very much in advance.
 
Sumitro Palit
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The specs don't provide any default transaction attribute - so developers are expected to provide one. The individual vendors usually provide a default (which varies, eg Weblogic might default to Supports while another vendor might set Required)- so if you don't provide a transaction attribute yourself, your code might not be portable between containers wrt transaction.
 
vu lee
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For EJB3, the default transaction attribute is REQUIRED. I believe this is portable accross all vendors
 
Sumitro Palit
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for clarifying that -- good to know that EJB 3 has finally provided a default transaction attribute.

The EJB3 specs - "JSR220: Section 13.3.7 - Specification of the Transaction Attributes for a Bean�s Methods" covers this in details incase anyone wants to go into the details.
 
PradeepPillai Pradeep
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks you all.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!