• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Regarding understanding of EJB Container Managed Transaction Attributes

 
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Paul .

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks that was really useful .
 
I think she's lovely. It's this tiny ad that called her crazy:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic