[jboss-user] [EJB 3.0] - EJB 3.0 Locking (entity not in the persistence context)

grdzeli_kaci do-not-reply at jboss.com
Mon Apr 16 09:45:23 EDT 2007


hi all,
i have some problems about locking,

i have 1 remote and one local interface
1. Remote Interface

  | public @Stateful
  | @Remote(RemoteInterface.class)
  | class RemoteInterfaceBean implements RemoteInterface
  | {
  |    
  |        @PersistenceContext(unitName = "CustomerCareOracle")
  | 	private EntityManager oracleManager;
  | 
  |         public MySomeEntityObject object;
  | 
  |        @EJB
  |         MyLocalInterface inter;    
  | 
  | 
  |     @TransactionAttribute(TransactionAttributeType.REQUIRED)
  |     public void fillMyObject(someparameters .... )
  |     {
  |       // filling MySomeEntityObject object
  |     }
  | 
  |     @TransactionAttribute(TransactionAttributeType.REQUIRED)
  |     public void commitMyObject()
  |     {
  |       inter.AnotherOperatOnObject(object);
  |       oracleManager.persist(object);
  |     }
  | }
  | 

2. My Local Interface

  | public @Stateless
  | @Local(MyLocalInterface.class)
  | class MyLocalInterfaceBean implements MyLocalInterface
  | {
  |    
  |        @PersistenceContext(unitName = "CustomerCareOracle")
  | 	private EntityManager oracleManager;
  | 
  |         @TransactionAttribute(TransactionAttributeType.REQUIRED)
  |          public void AnotherOperatOnObject(MySomeEntityObject object)
  |           {
  |                oracleManager.lock(object,LockModeType.READ); // <= Here I Got An Error
  |                // do some operation and is succsess, It's very good ;)
  |           }
  | }
  | 
  | 

when i tryed to lock object i got an error, i can't resolve this problem :(
can anybody help me ?

error trace


  | 17:43:21,343 ERROR [errorCat] java.lang.IllegalArgumentException: entity not in the persistence context
  |         at org.hibernate.ejb.AbstractEntityManagerImpl.lock(AbstractEntityManagerImpl.java:336)
  |         at org.jboss.ejb3.entity.TransactionScopedEntityManager.lock(TransactionScopedEntityManager.java:101)
  |         at com.magti.businesslayer.ejb3Fasade.oracle.ccare.TransactionFasadeBean.lockAccounts(TransactionFasadeBean.java:203)
  |         at com.magti.businesslayer.ejb3Fasade.oracle.ccare.TransactionFasadeBean.doAfterCheck(TransactionFasadeBean.java:76)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
  |         at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
  |         at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
  |         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  |         at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
  | 
  | 


Regards,
Paata.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037551#4037551

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037551



More information about the jboss-user mailing list