geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From unkno...@sohu.com
Subject Bepuzzlement
Date Wed, 17 Sep 2008 01:36:23 GMT
 

   Pls read as below code, why database don’t be updated when database be commit? 
It is very amusing, why database be updated when I shut down Geronimo (Version2.1.1)?
It was said that database be updated synchronization when a transaction was commit ?
Is it possible that Geronimo need special setup?

Remark: I use geronimo2.1.1, database is Oracle 9i
                 attached file can be deploy on geronimo 2.1.1 

 package zjEntity;
import javax.ejb.*;
import javax.annotation.Resource;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.transaction.UserTransaction;
@Stateless
@TransactionManagement(javax.ejb.TransactionManagementType.BEAN)
public class zjempBean implements zjempLocal
{  
    @PersistenceContext private EntityManager em;
    @Resource private javax.transaction.UserTransaction ut;

    public zjempBean()
    {
    }
    
    public boolean insertEmp(String empno,String empname)
     {
         try 
          {
            ut.begin();
             zjemp zjemp1=new zjemp();
             zjemp1.setEmpno(empno);
             zjemp1.setEmpname(empname);
             
             em.persist(zjemp1);
             ut.commit();                  /*after execute, no error message, but why not
update to database?*/
          }
        catch (Exception e)
         {
            e.printStackTrace();
            return false;
          }
        return true;
          
     }
}


Mime
View raw message