[jboss-user] [EJB 3.0] - Re: Simple EJB3 Transaction Question
grdzeli_kaci
do-not-reply at jboss.com
Tue Aug 8 03:17:30 EDT 2006
thanks. It's working but i have another problem :(
working code :
| @TransactionManagement(TransactionManagementType.BEAN)
| @Remote(Fasade.class)
| public @Stateless class FasadeBean implements Fasade
| {
| @PersistenceContext(unitName = "TEST")
| private EntityManager oracleManager;
| @Resource public UserTransaction utx;
|
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public void addTest(Test t) throws IllegalStateException, SecurityException, SystemException
| {
| try {
| System.out.println("============== Income =============");
| utx.begin();
| System.out.println("EntityManager = "+oracleManager);
| System.out.println("UserTransaction = "+utx);
|
| System.out.println("Test = "+t);
| oracleManager.persist(t);
|
| utx.commit();
| System.out.println(" =============== Persisted =======");
| } catch (Exception e) {
| utx.rollback();
| e.printStackTrace();
| }
| }
|
|
and then i did some changes on this :
remove commit from this method and create new methot :
| public void commit() throws IllegalStateException, SecurityException, SystemException
| {
| try {
| utx.commit();
| System.out.println(" =============== Commited =======");
| } catch (Exception e) {
| utx.rollback();
| e.printStackTrace();
| }
| }
|
i want that one method begis transactions and another finish it.
but i get an error :
| javax.ejb.EJBException: Application error: BMT stateless bean FasadeBean should complete transactions before returning (ejb1.1 spec, 11.6.1)
| at org.jboss.ejb3.tx.BMTInterceptor.checkStatelessDone(BMTInterceptor.java:184)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3963711#3963711
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3963711
More information about the jboss-user
mailing list