• 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
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Transaction confusion

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All

I hope my question makes sense .. . .

In the EJB HeadFirst on p509 they say for CMT: Compulsory for entity beans.

Now . . . I have been using entity beans (and session beans for that matter) without using a single <container-transaction > in the <assembly-descriptor> section in my DD(ejb.jar). Does the container automaticly use the 'Required' attribute for ALL the buisiness methods for a entity bean? (I am using JBoss btw).

As for the session beans , <transaction-type>Container/Bean</transaction-type> is always present in the <enterprise-beans> section , but what if nothing for that bean is spesified in <container-transaction > in the <assembly-descriptor> section - does the methods run in no transaction or is it also 'Required' for all by default ?

Regards

Christiaan
 
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

but what if nothing for that bean is spesified in <container-transaction > in the <assembly-descriptor> section - does the methods run in no transaction or is it also 'Required' for all by default ?



That is solely upto the container implementation. The spec does not guarantee what the transaction will be if the attribute is not specified.
 
Christiaan Pansegrouw
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks , but what about the comment :

CMT is Compulsory for entity beans.

does this mean that you can ONLY use CMT for entity bean , or CMT should ALWAYS be used for entity beans - or is this also up to your ejb-container's mercy ?
 
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Entity Beans can Use only CMT. The treansaction attribute if not specified then it depends upon the container. Weblogic 8.1 uses Supports as default. Not sure about jboss.

cheers
 
Christiaan Pansegrouw
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you choose not to use transactions for entity beans - ie. it is not a must to use transactions.
 
sawan parihar
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a intresting question . The EJBLoad and EJBStore methods are called with the start of a new transaction and not with every method call . That means on the basis of the transaction the container decides when to load and store.

I am not very sure but for select and finder methods specifiying no transaction makes sense but for other things we definitely need transactions.
 
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am not very sure but for select and finder methods specifiying no transaction makes sense


In a way it does make sens. Suppose we have CMR fields that are loaded. If we are not in a transaction, the data that is loaded can be "inconsistent" by the time we finish initializing an entity...

Miki
 
Quick! Before anybody notices! Cover it up with this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic