Questions tagged [bean-managed-transactions]

Bean-Managed Transactions (BMT) in EJB 3.1 spec allows to set transaction boundaries programmatically by obtaining a transaction and specifying `begin` and `end` of transaction in the code.

Bean-Managed Transactions (BMT) in EJB 3.1 spec allows to set transaction boundaries programmatically by obtaining a transaction and specifying begin and end of transaction in the code. When the transaction ends it should either commit or rollback. Managing beans in such a way explicitly define a control over the user transactions, independent of the container as opposed to Container-Managed Transactions (CMT) where transaction boundaries are set in a declarative way.

In a Bean-Managed transaction (BMT) code, you could explicitly mark the transaction boundaries in the session or message-driven bean. An entity bean cannot have bean-managed transactions; it must use Container-Managed Transactions (CMT) instead. Although beans with container-managed transactions require less coding, they have one limitation: when a method is executing, it can be associated with either a single transaction or no transaction at all. If this limitation will make coding your bean difficult, you should consider using bean-managed transactions.

Further reading about bean-managed transactions is from Java EE Tutorial.

24 questions
0
votes
2 answers

What is JTA with container managed transaction advantage

I use JavaEE 8 with OpenLiberty Application server . in my project i try to use JTA over container managed transaction (BMT) in CRUD layer . this is my example code : @Stateless @TransactionManagement(TransactionManagementType.CONTAINER) public…
mah454
  • 1,571
  • 15
  • 38
0
votes
1 answer

Calling a HTTP service within a JPA/JTA transaction - transaction integrity

I have a JSF/EJB/JPA application which uses container managed persistence. There is one case where a call is made to an external service via HTTP which has a cost, this cost being allocated back to the requesting user. In the current implementation…
Oversteer
  • 1,778
  • 1
  • 22
  • 38
0
votes
1 answer

TransactionImpleManager.suspend called implicitly

I have bean using BMT. Another bean using BMT is injected into the first. Now when the first one calls a method of the second one, suddenly the transaction is closed. In my code I narrowed it down to exactly the point before the method call and…
Thomas
  • 624
  • 11
  • 28
0
votes
0 answers

JPA/Hibernate: EntityManager.close() and IllegalStateException?

I have a logging service within a JEE environment which uses TransactionManagementType.BEAN because the logging should be independent from JTA transactions, so I have to deal with transactions by myself. Currently this logging service looks like…
Bevor
  • 8,396
  • 15
  • 77
  • 141
0
votes
1 answer

2 BMT ejbs 1 single TX = impossible?

In brief, and with linking to this topic: Is it possible to have 2 EJBs having Bean managed Transactions nature in which the first EJB calls a method in the second one and all are wrapped in single UserTransaction that starts from the first EJB?
user1017344
  • 181
  • 1
  • 1
  • 11
0
votes
1 answer

read-only transaction doesn't work in my AOP config

i'm trying to learn how to use AOP, and i'm trying to set a read-only transaction in the application context of Spring but it doesn't work, it stills committing data to the DB. I really don't know what i'm doing wrong, if you can help me, i'll be…
Alex
  • 1
0
votes
1 answer

Bean Managed MDB and Database exceptions

I have a Bean managed MDB -InvoiceInquiryMessageBean with the following definition which calls a CMT - InvoiceManager which performs database operations. The MDB is explicitly mentioned as Bean managed and the onMessage() has a transaction…
0
votes
1 answer

How do bean managed transactions work?

I am new both to EJB and Bean Managed Transactions. After scrapping the Internet, I found that I could write a EJ session Bean which does transactions the "bean-managed way", like…
MciprianM
  • 513
  • 1
  • 7
  • 18
0
votes
1 answer

Java, JPA, bean managed transactions, TransactionRequiredException

I have two stateless EJB. One uses container managed transactions, another - bean managed. From container managed EJB I call a method of bean managed EJB. public class firstEJB{ public void myMethod(){ ejb.longRunningMethod(); } …
Victor Mezrin
  • 2,797
  • 2
  • 32
  • 48
1
2