EJB « Transaction « Java Database Q&A





1. EJB Transactions in local method-calls    stackoverflow.com

In the following setup, does method B run in a (new) transaction? An EJB, having two methods, method A and method B

public class MyEJB implements SessionBean
    public void methodA() ...

2. When should I use EJB transaction attributes 'Mandatory' and 'Never'    stackoverflow.com

I am referring to container managed transaction attributes in Enterprise Java Beans. I can't think of any use cases where using 'Mandatory' and 'Never' makes sense. Can anyone please explain what ...

3. ejb-jar.xml : Allowed Methods for container-transaction tag    stackoverflow.com

Are we allowed to specify a method name with an access modifier of 'protected' or 'private' inside the <container-transaction><method></method></contaner-transaction> tag ? Below is a sample of the ejb-jar.xml:

<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1">
  ...

4. Nested transaction support in J2EE 1.4    stackoverflow.com

I read that EJB 2.x spec does not support nested transactions. But logically think we can call an EJB method that has REQUIRES_NEW txn attribute from another EJB method that acutally started ...

5. How to prevent "Local transaction already has 1 non-XA Resource" exception?    stackoverflow.com

I'm using 2 PU in stateless EJB and each of them is invoked on one method:

@PersistenceContext(unitName="PU")
private EntityManager em;
@PersistenceContext(unitName="PU2")
private EntityManager em2;

@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW )
public void getCandidates(final Integer eventId) throws ControllerException {
    ...

6. How do i catch exceptions from container managed transaction commit?    stackoverflow.com

I have a @Stateless EJB with a @WebService interface, using container managed transactions, meaning transactions are automatically committed by the container after a method has been called if it doesn't ...

7. how the Transaction concept is implemented in EJB    stackoverflow.com

I wan to know how the transaction is internally implemented in EJB. I want to know the logic they use to create a transaction. if you could point out some articles ...

8. How to expose an EJB as a web service that is not transactional?    stackoverflow.com

I have an EJB (coded using Java EE 6 annotations) that is defined as follows:

@Stateless
@WebService
public class SecurityWebService {

    public void registerUser(RegistrationRequest request) {
      ...

9. JEE: @ApplicationException thrown, still rolls back transactions    stackoverflow.com

I need some direction how to best use Exceptions in a JEE environment, serving clients via JAX-RS. At the moment, I have a number of exceptions, all extending RuntimeException, and annotated with ...





10. Using @TransactionAttribute(value = TransactionAttributeType.NEVER) on a method    stackoverflow.com

Can you call a method that requires a transaction inside a method that does not?

@TransactionAttribute(value = TransactionAttributeType.NEVER)
public void DoSomething(final List<Item> items) {

//can you call a method that requires a transaction here ...

11. how to commit a transaction in EJB?    stackoverflow.com

I have the following scenario,

public void someEjbMethod1()
{
    for (int i=0; i=10; i++)
    {
        em.merge(arr[i]);
     ...

12. can we use transaction mangament like transaction definition (required or Requiresnew) when we use session bean with JDBC?    stackoverflow.com

Can we specify the transactionManagent/transactionAttribute(like required or Requiresnew ) to mention how the Container must manage transactions for a method when a client invokes the method of session bean with ...

13. How should I implement Transaction database EJB 3.0    stackoverflow.com

In the CustomerTransactions entity, I have the following field to record what the customer bought:

@ManyToMany
private List<Item> listOfItemsBought;
When I think more about this field, there's a chance it may not work because ...

14. JDBC Transction over EJB Transaction    coderanch.com

15. Transactions in EJB    go4expert.com

hi all, I am little bit confused with EJB Transactions. What I heard is we cannot control transactions in EJB with Connection.setAutoCommint(false) and Connection.commit() and Connection.rollback(); the EJB Container Starts a Transaction , if everything goes well the transaction will be commited otherwise in the catch block we have use SessionContext.setRollbackOnly(); but I am getting different results... I have Stateless Session ...





17. EJB Transaction Problem    java-forums.org

Hi, I am trying to persist a data by using EntityManager.persist method. I am using EJB 3.0 Stateless Session Facade Bean and its transaction is Container-Managed. (CMP) After persist operation, within the same ejb method, I am trying to update the data by using a JDBC "Update" query. But the problem is that the data is not updated. The transaction is ...

19. Transaction State between two Ejb's    forums.oracle.com

Hi All, I am using Bean Managed Trasactions.If i call a method from one Ejb to Another Ejb new trasaction is created in called method and it is commited(If this Method Executes successfully).The old transaction which started in first Ejb is not yet commited(In calling Method). If calling method exceutes fails the old transaction rolledback.In this case i want new Trasaction ...

20. Ejb Transaction failure question?    forums.oracle.com

Hello, I use Ejb 2.0 and want to store some date in the DB. I put restriction on the table, Primary Key and Not null. If I put the key with a name already exist, all is null, I get: Transaction failure in method: Is it possible to get more detailed information, what was the reason of the problem? Because the ...

21. WebSphere 6 - TRANSACTION_ROLLEDBACK during create() on remote ejb    forums.oracle.com

Hi, I have an EJB running on a WSAD 5.1 which access a remote EJB running on WAS 6. The remote EJB uses a XA datasource. When the create() method is called, I get the following exception: javax.transaction.TransactionRolledbackException: CORBA TRANSACTION_ROLLEDBACK 0x0 No; nested exception is: org.omg.CORBA.TRANSACTION_ROLLEDBACK: Trace from server: 1198777258 at host li09 >> org.omg.CORBA.TRANSACTION_ROLLEDBACK: vmcid: 0x0 minor code: 0 completed: ...