3 Replies Latest reply on Dec 13, 2009 12:40 AM by esteveolm

    Strange Null Pointer in HibernateEntityHome

    pedrosena

      Hi Guys, I'm getting the following exception:


      java.lang.NullPointerException
              at org.jboss.seam.framework.Home.updatedMessage(Home.java:55)
              at org.jboss.seam.framework.HibernateEntityHome.update(HibernateEntityHome.java:41)
              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.seam.util.Reflections.invoke(Reflections.java:22)
              at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
              at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:40)
              at org.jboss.seam.util.Work.workInTransaction(Work.java:47)
              at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:34)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
              at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
              at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
              at br.com.netsar.infra.persistence.global.NetSarCustomerHome_$$_javassist_0.update(NetSarCustomerHome_$$_javassist_0.java)
              at br.com.netsar.infra.persistence.TestHome$2.testComponents(TestHome.java:83)
              at org.jboss.seam.mock.AbstractSeamTest$ComponentTest.run(AbstractSeamTest.java:163)
              at br.com.netsar.infra.persistence.TestHome.testNetSarCustomerHome(TestHome.java:91)




      And here is my testNetSarCustomerHome snippet:



      NetSarCustomerHome customerHome = (NetSarCustomerHome) getValue("#{netSarCustomerHome}");
                                      customerHome.setId(2);
                                      NetSarCustomer customer = customerHome.find();
                                      assert customer.getTradingName() != null;
                                      String backup = customer.getTradingName();
                                      String newTradingName = "NEW TRADING NAME!!";
                                      customer.setTradingName(newTradingName);
                                      customerHome.update();



      The null pointer is ocurring in the last line, when I make the update.


      The most strange thing is that my update is being commited to my database, so maybe is some kind of bug?


      All my Homes where conversation scoped, I changed it to Stateless Scope(what I believe that is the most appropriate) and this error started to occur.


      Am I wrong to make my Homes Stateless scoped ??


      Thanks,


      Pedro Sena