• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question regarding mandatory TX attributes

 
B.Sathish
Ranch Hand
Posts: 372
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the transactions chapter in HFEJB, the book talks about the methods that you must mark with a transaction attribute, but it does not say what you can/cannot put as the value of the attribute, if you do need to mark it. For example, the create method of an entity bean must be marked with a transaction attribute. Does that mean I can give any value? What happens if I mark create of an entity bean with NotSupported attribute?

In general, what would happen if I have say, a business method that access a database (say update), but I mark it with NotSupported attribute?
 
S.L.Narayanan
Ranch Hand
Posts: 431
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure whether you can put NotSupported to create method of an entity bean but I think you can. But in general, if you put NotSupoorted to any method, you cannot call SetRollbackOnly() and GetRollbackOnly(). Not only that, your method runs in an unspecified transaction context. It depends on the container to allow/disallow the parent method's transaction. It is clearly explained on the same page in HFEJB under the heading Unknown Transaction Context.
 
B.Sathish
Ranch Hand
Posts: 372
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, I understand what is given in the HFEJB. But I just was not sure what would happen if an entity bean create method has a NotSupported attribute. I too think the container would simply accept it and do whatever it pleases like start it's own transaction etc
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by B Sathish:
But I just was not sure what would happen if an entity bean create method has a NotSupported attribute.

The underlying persistence mechanism may not support transactions so the create/NotSupported should be legal. This would however remove a strong motivator for using EJBs in the first place but you may want to take advantage of some of the other services that the EJB container offers.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic