1 Reply Latest reply on May 27, 2009 5:02 AM by Adam Warski

    @IndexColumn exception

    Ido Ran Newbie

      Hi,
      I'm developing EJB3 application using JPA with Hibernate 3.4.0GA.
      I've change one of my entities which until now had Set as backed property for one-to-many relation to List.
      I've add @org.hibernate.annotations.IndexColumn annotation on the list and int property for the index in the referenced entity (just like hibernate_annotations.pdf explain in page 41).

      Of course I also have envers in my project.
      Now when I deploy my project into GlassFish I get the following exception:

      The entity in the one end (of the one-to-many relation) called ProcessJournal and the entity in the many called Activity.

      This is a snippet of the ProcessJournal entity class:

      @Entity
      @Audited
      public class ProcessJournal implements AuroraNamedEntity, Serializable {
      
       private static final long serialVersionUID = 1L;
      
       @Id
       @Column(length = 36)
       private String id;
      
       @Column(nullable=false)
       private String name;
      
       @OneToMany(mappedBy = "process", cascade = CascadeType.ALL)
       @org.hibernate.annotations.IndexColumn(name="OrderIndex", nullable=false)
       private List<Activity> activities;
      }
      


      This is snippet of the Activity enetity:
      @Entity
      @Audited
      public class Activity implements AuroraNamedEntity, Serializable {
      
       private static final long serialVersionUID = 1L;
      
       @Id
       private String id;
      
       @Column(name="OrderIndex")
       private int orderIndex;
      }
      


      [PersistenceUnit: AuroraServicePU] Unable to build EntityManagerFactory
      javax.persistence.PersistenceException: [PersistenceUnit: AuroraServicePU] Unable to build EntityManagerFactory
       at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
       at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
       at com.sun.enterprise.server.PersistenceUnitLoaderImpl.load(PersistenceUnitLoaderImpl.java:149)
       at com.sun.enterprise.server.PersistenceUnitLoaderImpl.load(PersistenceUnitLoaderImpl.java:84)
       at com.sun.enterprise.server.AbstractLoader.loadPersistenceUnits(AbstractLoader.java:895)
       at com.sun.enterprise.server.ApplicationLoader.doLoad(ApplicationLoader.java:184)
       at com.sun.enterprise.server.TomcatApplicationLoader.doLoad(TomcatApplicationLoader.java:126)
       at com.sun.enterprise.server.ExtendedApplicationLoader.doLoad(ExtendedApplicationLoader.java:134)
       at com.sun.enterprise.server.AbstractLoader.load(AbstractLoader.java:238)
       at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:336)
       at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:210)
       at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:645)
       at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeApplicationDeployEventListener(AdminEventMulticaster.java:959)
       at com.sun.enterprise.admin.event.AdminEventMulticaster.handleApplicationDeployEvent(AdminEventMulticaster.java:943)
       at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:467)
       at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:182)
       at com.sun.enterprise.admin.server.core.DeploymentNotificationHelper.multicastEvent(DeploymentNotificationHelper.java:308)
       at com.sun.enterprise.deployment.phasing.DeploymentServiceUtils.multicastEvent(DeploymentServiceUtils.java:231)
       at com.sun.enterprise.deployment.phasing.ServerDeploymentTarget.sendStartEvent(ServerDeploymentTarget.java:298)
       at com.sun.enterprise.deployment.phasing.ApplicationStartPhase.runPhase(ApplicationStartPhase.java:132)
       at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:108)
       at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:966)
       at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:609)
       at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:653)
       at com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.start(ApplicationsConfigMBean.java:773)
       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:597)
       at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:381)
       at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:364)
       at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:477)
       at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
       at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
       at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:90)
       at $Proxy1.invoke(Unknown Source)
       at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:304)
       at com.sun.enterprise.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:174)
       at com.sun.enterprise.admin.jmx.remote.server.callers.InvokeCaller.call(InvokeCaller.java:69)
       at com.sun.enterprise.admin.jmx.remote.server.MBeanServerRequestHandler.handle(MBeanServerRequestHandler.java:155)
       at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.processRequest(RemoteJmxConnectorServlet.java:122)
       at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.doPost(RemoteJmxConnectorServlet.java:193)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
       at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:315)
       at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
       at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
       at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096)
       at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:288)
       at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:647)
       at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:579)
       at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:831)
       at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
       at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
       at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
       at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
       at com.sun.enterprise.web.connector.grizzly.WorkerThreadImpl.run(WorkerThreadImpl.java:116)
      Caused by: org.hibernate.HibernateException: could not init listeners
       at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:205)
       at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1338)
       at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
       at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
       at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
       ... 73 more
      Caused by: org.hibernate.MappingException: Unable to read the mapped by attribute for activities in org.dna.aurora.core.ProcessJournal!
       at org.hibernate.envers.configuration.metadata.CollectionMetadataGenerator.getMappedBy(CollectionMetadataGenerator.java:520)
       at org.hibernate.envers.configuration.metadata.CollectionMetadataGenerator.addWithMiddleTable(CollectionMetadataGenerator.java:272)
       at org.hibernate.envers.configuration.metadata.CollectionMetadataGenerator.addCollection(CollectionMetadataGenerator.java:153)
       at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.addValue(AuditMetadataGenerator.java:141)
       at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.addProperties(AuditMetadataGenerator.java:161)
       at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.generateSecondPass(AuditMetadataGenerator.java:385)
       at org.hibernate.envers.configuration.EntitiesConfigurator.configure(EntitiesConfigurator.java:96)
       at org.hibernate.envers.configuration.AuditConfiguration.<init>(AuditConfiguration.java:86)
       at org.hibernate.envers.configuration.AuditConfiguration.getFor(AuditConfiguration.java:99)
       at org.hibernate.envers.event.AuditEventListener.initialize(AuditEventListener.java:249)
       at org.hibernate.event.EventListeners$1.processListener(EventListeners.java:198)
       at org.hibernate.event.EventListeners.processListeners(EventListeners.java:181)
       at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:194)
       ... 77 more