Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB Transactions inWeblogic

 
S Subramonyan
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I just started learning EJB. But my employer said, I should go straight to Transactions so that he could get me a project soon. So what I did was, I created some Sessions Beans, Entity Beans etc first. Now I want to do a simple EJB project that makes use of Transactions. Could anyone please give me some sample code / ideas so that I can build a simple transaction-based EJBProject to start learning? In fact I tried on my own, but it failed. Exceptions are overflowing!!! :-)

I use Weblogic. Anything particular to Weblogic is greatly appreciated.

Thank you very much.
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Um .... transactions are provided by your EJB container. You can't create an EJB project without transactions.
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by S Subramonyan:
I understand, there are both Container-managed and Bean Managed. Bean Managed you write explicit code, right?

Yes, that is correct. With container-managed transactions (CMT), you tag each method (either in the deployment descriptor or via a tool like XDoclet which results in the same thing) with a transaction attribute that tells the container how to involve the method transactionally.

With bean-managed transactions (BMT) you do all that work yourself. The result is the same (you either start or do not start a transaction), but with BMT you have complete control along with full responsibility. For this you'll work directly with a UserTransaction (begin, commit and rollback methods).

All of the above is covered in detail in the EJB specification and in many books and online resources. If you are not using XDoclet already, I recommend looking into it. Basically, it generates your deployment descriptors using JavaDoc tags in your source code.

Finally, after skimming some resources, come back and ask specific questions that we can answer. While I could paste a portion of one of my deployment descriptors, it would be utterly meaningless without some background.

I have found Rod Johnson's books Expert One-on-One J2EE Development (both with and without EJB) to be very good, clear and concise, and backed up with experience that matches my own.
 
S Subramonyan
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In fact what I meant was, some sample code to demonstrate the transaction mechanism. From the theory that I read, I understand, there are both Container-managed and Bean Managed. Bean Managed you write explicit code, right?

If some one please help me out here, that would be just great!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic