• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Regarding understanding of EJB Container Managed Transaction Attributes  RSS feed

 
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

This question is regarding using of EJB Transaction Attributes (Container Managed).

For Example if Required Attribute is there , it says that :

If the client is not associated with a transaction context, the container AUTOMATICALLY STARTS a new transaction before delegating a method call to the enterprise Bean business method.

What does this mean , my question is how the servlet is associated with a Transaction ??


Means , I have used EJB's in my two projects , but we used to call Session Bean class from my servlet with out any Transation .

My question is how the servlet or a normal java class will be associated with a Transaction ?? (Does this mean JTA)

Please help me in understanding .

Thanks .
 
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


My question is how the servlet or a normal java class will be associated with a Transaction ?? (Does this mean JTA)


Yes, it does.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul . That was really usefull and as far as my knowledge is concerned we will go for JTA only concerned only when we are using multiple Resources (For example different DataBases ) .

So in normal projects JTA would not be applicable . correct me if i am wrong .

Please reply . Thanks in advance.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are wrong. JTA is nothing more than an API for transaction handling. You can use it with single or multiple transactional resources (transactions are not limited to databases). You you have more than one transactional resource that needs to participate in a single transaction you need JTA with "two phase commit" (google for it if you don;t know the term).
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Paul .

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An EJB can be a client to another EJB. For Ex: EJB_A invokes a business method on EJB_B then EJB_A is a client of EJB_B. If EJB_A is associated with a transaction then EJB_B shares the same transaction context if EJB_B has "Required" transaction attribute set. EJB_B cannot use the traansaction of EJB_A when EJB_B's transaction attribute is "RequiresNew" or "NotSupported"
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Eshwar , could you please tell me ,

If EJB_A is associated with a transaction



How can EJB_A will be associated with a transaction without using JTA ??
 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ravi Kiran V wrote:
My question is how the servlet or a normal java class will be associated with a Transaction ?? (Does this mean JTA)



JTA is J2EE API . Available to any Java component getting executing in J2EE Container -


Ravi Kiran V wrote:
How can EJB_A will be associated with a transaction without using JTA ??



technically we can have JDBC transactions in EJB methods...
But this transaction would not be considered while evaluating Transaction attributes conditions by EJB container .... (required / requiredNew etc ... )

let me know in case you have any specific question...
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks that was really useful .
 
Acetylsalicylic acid is aspirin. This could be handy too:
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!