// attribute never. The other method with the same name, but with
// diferent attributes, has the general tarsnaction attribute(REQUIRED).
// The transaction attribute is never, so when the method is called with
// a transactional context, an exception must be throw.
UserTransaction utx = TransactionHelper.getInternalUserTransaction();
try {
utx.begin();
bean.insertTable03(DB_NAME, TABLE_NAME);
fail("A method with transaction attribute never is not throwing an "
+ "EJBException when it is called with transaction context");
} catch (Exception e) {
assertTrue(e instanceof EJBException,
"A method with transaction attribute never is not throwing an "
+ "EJBException when it is called with transaction context");
} finally {
utx.rollback();
}
// cleans the db to avoid error
deleteTable(DB_NAME, TABLE_NAME);
// the transaction attribute defined for all methods is required, so the
// method must work with or without a client transaction.
// the method is working with transaction...
utx.begin();
bean.insertTable03(DB_NAME, TABLE_NAME, 1);
utx.commit();
// cleans the db to avoid error
deleteTable(DB_NAME, TABLE_NAME);
// the method is working without transaction