You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by un...@sohu.com on 2008/09/17 03:36:23 UTC

Bepuzzlement

 

   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;
          
     }
}



Re: Bepuzzlement

Posted by David Jencks <da...@yahoo.com>.
This is a user list question.

This problem is usually caused by not using an oracle specific tranql  
wrapper but using the generic tranql wrapper and not setting the  
commitBeforeAutocommit property to true.  The oracle drivers are  
generally not jdbc spec compliant and need this extra setting to work  
properly.

If you need more help please reply to the user list and include your  
database connector deployment plan and tell us which tranql adapter  
you are using.

thanks
david jencks

On Sep 16, 2008, at 6:36 PM, unknowit@sohu.com wrote:

>
>
>   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;
>
>     }
> }
>
>
> <zjemp.ear>