• Post Reply Bookmark Topic Watch Topic
  • New Topic

ejb & pojo transactions  RSS feed

 
manish ahuja
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

Currently we have few POJO's which encapsulate all business logic. They interact with the DB, have their own transactions.

Now we are planning to expose these POJO's as ejb's.
As the POJO's already have their own transactions, we dont want to remove it as apart from ejb we plan to have even web services layer on top of these POJO's.
Now when the ejb's with their own transaction context access the POJO object, I reckon that would amount to nested transactions which the EJB containers do not support (correct me if I m wrong).

I am bit stuck on this.

Your thoughts on the same will be very helpful for me

Thanks
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi manish,


As the POJO's already have their own transactions, we dont want to remove it as apart from ejb we plan to have even web services layer on top of these POJO's.

If you intend to have BMT with your beans, then you cannot expose your POJO as entity beans; entity ejbs don�t support BMT. Therefore you need to wrap your POJOs with SLSBs.

Now when the ejb's with their own transaction context access the POJO object, I reckon that would amount to nested transactions which the EJB containers do not support

That�s correct if you use JTS/JTA. However if you�re using JDBC transactions and your database driver supports nested transactions, then you might be able to implement nested transactions with your container as well. However in that case you cannot have global (distributed) transactions and you are limited to using only one type of persistence storage. Your application won�t be very portable either. Bottom line is what J2EE recommends: if your application needs a nested transactional model, then J2EE might not be the right solution for you.
Regards.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!