8 Replies Latest reply on Aug 18, 2009 11:41 PM by Pete Muir

    understand ValidateBean

    Diego Coronel Apprentice

      Hi Folks,

      i was playing with some webBeans possibilities and i got this problem:

      I did a provider like this:

      public class PersistenceProvider implements Serializable {
           private static final long serialVersionUID = 1L;
           @Produces  @PersistenceContext @ConversationScoped @ManualFlushMode @Database
           private EntityManagerSerializable entityManager;

      and i got this error:

      11:05:32,124 ERROR [AbstractKernelController] Error installing to Start: name=vfsfile:/C:/trabalho_diego/jboss-5.1.0.GA/server/web/deploy/HelloWebBeans.ear/_WebBeansBootstrapBean state=Create
      javax.enterprise.inject.UnproxyableResolutionException: Normal scoped bean Annotated Conversation scoped unnamed producer field bean [com.fpf.provider.PersistenceProvider] for class type [com.fpf.provider.EntityManagerSerializable] API types [class java.lang.Object, interface java.io.Serializable, interface javax.persistence.EntityManager, class org.hibernate.ejb.AbstractEntityManagerImpl, class com.fpf.provider.EntityManagerSerializable, interface org.hibernate.ejb.HibernateEntityManager, interface org.hibernate.ejb.HibernateEntityManagerImplementor, class org.hibernate.ejb.EntityManagerImpl], binding types [@javax.enterprise.inject.Any(), @com.fpf.provider.Database()] is not proxyable
           at org.jboss.webbeans.Validator.validateBean(Validator.java:81)

      so, it says that my bean isnt proxyable AND is normal scoped, but shouldnt it be considered @ConversationScoped? so, isnt my entityManager annotations considered for validations ? because if i change @ConversationScoped annotation to my @Database it works because now the validation didnt throw exception:


       boolean normalScoped = beanManager.getServices().get(MetaAnnotationStore.class).getScopeModel(bean.getScopeType()).isNormal();
            if (normalScoped && !Beans.isBeanProxyable(bean))
               throw new UnproxyableResolutionException("Normal scoped bean " + bean + " is not proxyable");

      so, is it expected?