3 Replies Latest reply on Sep 26, 2005 12:30 PM by dornus

    Cannot use transient class within a entity class

      Maybe I'm not doing this correctly, but I was playing around and could not get this to work. My guess is that the war file gets loaded after the par file, resulting in the error. It compiles fine and shows no errors in IntelliJ, so the class is there and is in the correct package structure.

      @Entity
      @Table(name = "example")
      public class Example{
       //..gets/sets and variables for the table mapping
      
       // Call a custom class residing in my war file.
       private transient Messages messages;
      
       @Transient
       public Messages getMessages(){
       if (messages == null){
       messages = new Messages();
       }
       return messages;
       }
      
      }
      


      Adding the code shown above results in the following error
      11:22:52,721 WARN [ServiceController] Problem creating service jboss.j2ee:service=EJB3,module=MyExample.par
      java.lang.NoClassDefFoundError: web/Messages
       at java.lang.Class.getDeclaredMethods0(Native Method)
       at java.lang.Class.privateGetDeclaredMethods(Class.java:2365)
       at java.lang.Class.getDeclaredMethods(Class.java:1763)
       at org.hibernate.cfg.AnnotationBinder.addElementsOfAClass(AnnotationBinder.java:797)
       at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:638)
       at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:256)
       at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:191)
       at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:970)
       at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:607)
       at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:75)
       at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:473)
       at org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:202)
       at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:78)
       at org.jboss.ejb3.Ejb3Deployment.initializeManagedEntityManagerFactory(Ejb3Deployment.java:512)
       at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:253)
       at org.jboss.ejb3.Ejb3JmxDeployment.create(Ejb3JmxDeployment.java:230)
       at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:34)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:252)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:234)
       at sun.reflect.GeneratedMethodAccessor87.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
      ...