Search in sources :

Example 1 with Customer

use of org.jboss.as.quickstarts.cmt.model.Customer in project quickstart by wildfly.

the class CustomerManagerEJB method createCustomer.

@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void createCustomer(String name) throws RemoteException, JMSException {
    logMessageManager.logCreateCustomer(name);
    Customer c1 = new Customer();
    c1.setName(name);
    entityManager.persist(c1);
    invoiceManager.createInvoice(name);
    // after the fact but before the transaction is committed.
    if (!nameIsValid(name)) {
        throw new EJBException("Invalid name: customer names should only contain letters & '-'");
    }
}
Also used : Customer(org.jboss.as.quickstarts.cmt.model.Customer) EJBException(javax.ejb.EJBException) TransactionAttribute(javax.ejb.TransactionAttribute)

Example 2 with Customer

use of org.jboss.as.quickstarts.cmt.model.Customer in project quickstart by wildfly.

the class CustomerManagerEJB method createCustomer.

@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void createCustomer(String name) throws RemoteException, JMSException {
    Customer c1 = new Customer();
    c1.setName(name);
    entityManager.persist(c1);
    final InvoiceManagerEJB invoiceManager = invoiceManagerHome.create();
    invoiceManager.createInvoice(name);
}
Also used : Customer(org.jboss.as.quickstarts.cmt.model.Customer) TransactionAttribute(javax.ejb.TransactionAttribute)

Aggregations

TransactionAttribute (javax.ejb.TransactionAttribute)2 Customer (org.jboss.as.quickstarts.cmt.model.Customer)2 EJBException (javax.ejb.EJBException)1