1 Reply Latest reply on Sep 15, 2005 1:32 PM by manica

    Enums in Criteria API

    manica Newbie

      I have an enum that works fine everywhere except when used in a Criteria.

      enum:

      public enum AvailabilityEnum { CLOSE, OPEN, CALL, NO_ARRIVE }
      

      entity bean: (Inventory)
      ...
      @Column(columnDefinition = "VARCHAR(9)")
      public AvailabilityEnum getAvailability() {
       return availability;
      }
      
      public void setAvailability(AvailabilityEnum availability) {
       this.availability = availability;
      }
      ...
      

      session bean:
      ...
      session.createCriteria(Inventory.class).add(Expression.ne("availability", AvailabilityEnum.CLOSE)).list();
      ...
      



      I get the following stack trace


      javax.ejb.EJBException: null; CausedByException is:
      exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.ehr.advantage.ejb.entity.Inventory.setAvailability
      at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:46)
      at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:70)
      at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:134)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
      at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:61)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
      at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:39)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
      at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:63)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
      at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:91)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
      at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:152)
      at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:60)
      at $Proxy338.propertySearch(Lcom.ehr.advantage.valueobject.HotelSearch;[Ljava.lang.String;)Ljava.util.Set;(Unknown Source)
      at com.ehr.advantage.ejb.session.HotelSearchServiceBeanTest.testPropertySearchForCityAndState(HotelSearchServiceBeanTest.java:89)
      at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
      at jrockit.reflect.InitialMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
      at junit.framework.TestCase.runTest(TestCase.java:154)


      Thank you,
      Darin