-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: ejb 3.0 optimistic locking problem
PostPosted: Tue Apr 03, 2007 10:07 am 
Beginner
Beginner

Joined: Tue Jan 17, 2006 6:16 am
Posts: 31
i tryed to use locking into ejb 3.0
here is my program fragment
Code:
@Stateful
@Remote(CountFasade.class)
public class CountFasadeBean implements CountFasade {

   @PersistenceContext(unitName = "Test", type = PersistenceContextType.EXTENDED)
   private EntityManager oracleManager;

   @TransactionAttribute(TransactionAttributeType.REQUIRED)
   public void update(long start, long end) throws Exception {
      try {
         System.out.println("================ Start ================");
         Test test = oracleManager.find(Test.class, 1100011L);
         System.out.println("test id = " + test.getId());
         System.out.println("test name = " + test.getName());
         System.out.println("test surname = " + test.getSurname());
         System.out.println("test age = " + test.getAge());   
      
         oracleManager.lock(test, LockModeType.WRITE);

         test.setSurname("From Javaaaa");

         oracleManager.merge(test);

         Thread.sleep((1000 * 20));

         oracleManager.flush();
         System.out.println("================ End ================");
      } catch (Exception e) {
         e.printStackTrace();
         System.out
               .println("================ Exception Own ================");
      }
   }
}




but when i tryed to use this method from client i got an error like this :

Code:
18:04:48,423 ERROR [STDERR] java.lang.NullPointerException
18:04:48,424 ERROR [STDERR]     at org.hibernate.persister.entity.AbstractEntityPersister.lock(AbstractEntityPersister.java:1282)
18:04:48,424 ERROR [STDERR]     at org.hibernate.event.def.AbstractLockUpgradeEventListener.upgradeLock(AbstractLockUpgradeEventListener.java:88)
18:04:48,424 ERROR [STDERR]     at org.hibernate.event.def.DefaultLockEventListener.onLock(DefaultLockEventListener.java:64)
18:04:48,424 ERROR [STDERR]     at org.hibernate.impl.SessionImpl.fireLock(SessionImpl.java:586)
18:04:48,424 ERROR [STDERR]     at org.hibernate.impl.SessionImpl.lock(SessionImpl.java:578)
18:04:48,424 ERROR [STDERR]     at org.hibernate.ejb.AbstractEntityManagerImpl.lock(AbstractEntityManagerImpl.java:337)
18:04:48,424 ERROR [STDERR]     at org.jboss.ejb3.entity.ExtendedEntityManager.lock(ExtendedEntityManager.java:89)
18:04:48,424 ERROR [STDERR]     at tempPackage.CountFasadeBean.update(CountFasadeBean.java:51)
18:04:48,424 ERROR [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
18:04:48,424 ERROR [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
18:04:48,425 ERROR [STDERR]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
18:04:48,425 ERROR [STDERR]     at java.lang.reflect.Method.invoke(Method.java:585)
18:04:48,425 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
18:04:48,425 ERROR [STDERR]     at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
18:04:48,425 ERROR [STDERR]     at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
18:04:48,425 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
18:04:48,425 ERROR [STDERR]     at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:71)
18:04:48,425 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
18:04:48,425 ERROR [STDERR]     at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
18:04:48,428 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
18:04:48,428 ERROR [STDERR]     at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
18:04:48,428 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
18:04:48,428 ERROR [STDERR]     at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
18:04:48,428 ERROR [STDERR]     at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
18:04:48,428 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
18:04:48,428 ERROR [STDERR]     at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
18:04:48,428 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
18:04:48,428 ERROR [STDERR]     at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:81)
18:04:48,428 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
18:04:48,429 ERROR [STDERR]     at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
18:04:48,429 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
18:04:48,429 ERROR [STDERR]     at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
18:04:48,429 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
18:04:48,458 ERROR [STDERR]     at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
18:04:48,458 ERROR [STDERR]     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
18:04:48,458 ERROR [STDERR]     at org.jboss.ejb3.stateful.StatefulContainer.dynamicInvoke(StatefulContainer.java:297)
18:04:48,458 ERROR [STDERR]     at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
18:04:48,458 ERROR [STDERR]     at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
18:04:48,488 ERROR [STDERR]     at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
18:04:48,488 ERROR [STDERR]     at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
18:04:48,488 ERROR [STDERR]     at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
18:04:48,488 ERROR [STDERR]     at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:412)
18:04:48,488 ERROR [STDERR]     at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)




can anybody help me ?

Regards,
Paata.


Top
 Profile  
 
 Post subject: Re: ejb 3.0 optimistic locking problem
PostPosted: Wed Apr 04, 2007 5:07 am 
Beginner
Beginner

Joined: Tue Jan 17, 2006 6:16 am
Posts: 31
is there anybody on this forum who can help me a bit ?


i think that this is hibernate bug ? i can't find anything about it in jira ?


please help me, i need this option from hibernate :(


Regards,
Paata.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 02, 2007 9:53 am 
Beginner
Beginner

Joined: Thu Jan 25, 2007 3:36 pm
Posts: 25
Did you resolve this? If not what version of Hibernate are you using?

I'm getting the same problem and although it sounds like a similar (if not the same) problem was fixed in v3.2.1, I'm using 3.2.2 and still seeing this.

Darren


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 02, 2007 5:32 pm 
Newbie

Joined: Fri Apr 20, 2007 3:46 pm
Posts: 15
Take a look at this post

http://forum.hibernate.org/viewtopic.ph ... type+write


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 02, 2007 5:40 pm 
Beginner
Beginner

Joined: Thu Jan 25, 2007 3:36 pm
Posts: 25
Yeah thanks, I saw that. That's what prompted me to write.

I.e. in that post, Emmanuel says

Quote:
This was a bug, it is fixed in 3.2.1


and I said

Quote:
... although it sounds like a similar (if not the same) problem was fixed in v3.2.1, I'm using 3.2.2 and still seeing this.


That's why I was interested in what version Paata is using.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.