0 Replies Latest reply on Jan 15, 2009 2:43 AM by chit ko

    annotation @ForeignKey is disallowed for this location

    chit ko Newbie

      I am doing exactly like seam wiki example but in entity class, get this error compilation problem: The annotation @ForeignKey is disallowed for this location
      What am I missing? 


      Enviroment:
      EAR deployment
      Eclipse 3.4
      Jboss Seam 2.1.1
      JBOSS AS 4.2.3
      Hibernate EntityManager 3.3.1.GA
      Hibernate Search 3.1.0.GA
      Hibernate Annotations 3.4.0.GA



      package org.jboss.seam.wiki.core.model;
      
      import javax.persistence.*;
      @Entity
      @Table(name = "WIKI_UPLOAD_IMAGE")
      @org.hibernate.annotations.ForeignKey(name = "FK_WIKI_UPLOAD_IMAGE_NODE_ID")
      //TODO: @org.hibernate.annotations.OnDelete(action = org.hibernate.annotations.OnDeleteAction.CASCADE)
      public class WikiUploadImage extends WikiUpload<WikiUploadImage> {
      





      
      7:31:27,501 ERROR [STDERR] 2313 [main] INFO org.hibernate.search.Version - Hibernate Search 3.1.0.GA
      17:31:27,532 ERROR [STDERR] 2344 [main] WARN org.hibernate.search.engine.DocumentBuilderContainedEntity - @DocumentId specified on an entity which is not indexed by itself. Annotation gets ignored. Use @Field instead.
      17:31:27,563 ERROR [STDERR] 2375 [main] WARN org.hibernate.search.engine.DocumentBuilderContainedEntity - @DocumentId specified on an entity which is not indexed by itself. Annotation gets ignored. Use @Field instead.
      17:31:27,563 ERROR [STDERR] 2375 [main] WARN org.hibernate.search.engine.DocumentBuilderContainedEntity - @DocumentId specified on an entity which is not indexed by itself. Annotation gets ignored. Use @Field instead.
      17:31:27,594 ERROR [STDERR] 2406 [main] WARN org.hibernate.search.store.DirectoryProviderHelper - Index directory not found, creating: 'C:\iastore\indexes\org.jboss.seam.wiki.core.model.User'
      17:31:27,813 ERROR [STDERR] 2625 [main] WARN org.hibernate.search.store.DirectoryProviderHelper - Index directory not found, creating: 'C:\iastore\indexes\org.jboss.seam.wiki.core.model.WikiDocument'
      17:31:27,876 ERROR [STDERR] 2688 [main] WARN org.hibernate.search.store.DirectoryProviderHelper - Index directory not found, creating: 'C:\iastore\indexes\org.jboss.seam.wiki.core.model.WikiComment'
      17:31:27,938 ERROR [STDERR] 2750 [main] WARN org.hibernate.search.engine.DocumentBuilderContainedEntity - @DocumentId specified on an entity which is not indexed by itself. Annotation gets ignored. Use @Field instead.
      17:31:27,938 ERROR [STDERR] 2750 [main] WARN org.hibernate.search.engine.DocumentBuilderContainedEntity - @DocumentId specified on an entity which is not indexed by itself. Annotation gets ignored. Use @Field instead.
      17:31:27,938 ERROR [STDERR] 2750 [main] WARN org.hibernate.search.engine.DocumentBuilderContainedEntity - @DocumentId specified on an entity which is not indexed by itself. Annotation gets ignored. Use @Field instead.
      17:31:27,954 ERROR [STDERR] 2766 [main] WARN org.hibernate.search.engine.DocumentBuilderContainedEntity - @DocumentId specified on an entity which is not indexed by itself. Annotation gets ignored. Use @Field instead.
      17:31:27,954 ERROR [STDERR] 2766 [main] WARN org.hibernate.search.engine.DocumentBuilderContainedEntity - @DocumentId specified on an entity which is not indexed by itself. Annotation gets ignored. Use @Field instead.
      17:31:27,969 ERROR [STDERR] 2781 [main] WARN org.hibernate.search.engine.DocumentBuilderContainedEntity - @DocumentId specified on an entity which is not indexed by itself. Annotation gets ignored. Use @Field instead.
      17:31:27,969 ERROR [STDERR] 2781 [main] WARN org.hibernate.search.engine.DocumentBuilderContainedEntity - @DocumentId specified on an entity which is not indexed by itself. Annotation gets ignored. Use @Field instead.
      17:31:27,969 ERROR [STDERR] 2781 [main] WARN org.hibernate.search.engine.DocumentBuilderContainedEntity - @DocumentId specified on an entity which is not indexed by itself. Annotation gets ignored. Use @Field instead.
      17:31:27,969 ERROR [STDERR] 2781 [main] WARN org.hibernate.search.engine.DocumentBuilderContainedEntity - @DocumentId specified on an entity which is not indexed by itself. Annotation gets ignored. Use @Field instead.
      17:31:27,969 ERROR [STDERR] 2781 [main] WARN org.hibernate.search.engine.DocumentBuilderContainedEntity - @DocumentId specified on an entity which is not indexed by itself. Annotation gets ignored. Use @Field instead.
      17:31:27,969 ERROR [STDERR] 2781 [main] WARN org.hibernate.search.engine.DocumentBuilderContainedEntity - @DocumentId specified on an entity which is not indexed by itself. Annotation gets ignored. Use @Field instead.
      17:31:27,985 ERROR [STDERR] 2797 [main] WARN org.hibernate.search.engine.DocumentBuilderContainedEntity - @DocumentId specified on an entity which is not indexed by itself. Annotation gets ignored. Use @Field instead.
      17:31:28,063 ERROR [STDERR] 2875 [main] INFO org.hibernate.impl.SessionFactoryImpl - building session factory
      17:31:28,454 WARN  [ServiceController] Problem starting service persistence.units:ear=wikicon-ear.ear,unitName=wikicon
      javax.persistence.PersistenceException: org.hibernate.InstantiationException: could not instantiate test objectorg.jboss.seam.wiki.core.model.WikiUploadImage
           at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:737)
           at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:127)
           at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:246)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
           at java.lang.reflect.Method.invoke(Unknown Source)
           at org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:103)
           at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
           at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
           at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
           at java.lang.reflect.Method.invoke(Unknown Source)
           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
           at $Proxy0.start(Unknown Source)
           at org.jboss.system.ServiceController.start(ServiceController.java:417)
           at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
           at java.lang.reflect.Method.invoke(Unknown Source)
           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
           at $Proxy69.start(Unknown Source)
           at org.jboss.ejb3.JmxKernelAbstraction.install(JmxKernelAbstraction.java:120)
           at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:627)
           at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:351)
           at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:91)
           at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
           at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
           at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
           at java.lang.reflect.Method.invoke(Unknown Source)
           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
           at $Proxy0.start(Unknown Source)
           at org.jboss.system.ServiceController.start(ServiceController.java:417)
           at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
           at java.lang.reflect.Method.invoke(Unknown Source)
           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
           at $Proxy33.start(Unknown Source)
           at org.jboss.ejb3.EJB3Deployer.start(EJB3Deployer.java:512)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
           at java.lang.reflect.Method.invoke(Unknown Source)
           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
           at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
           at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
           at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
           at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
           at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:87)
           at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
           at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
           at $Proxy34.start(Unknown Source)
           at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
           at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1015)
           at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
           at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
           at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
           at java.lang.reflect.Method.invoke(Unknown Source)
           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
           at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
           at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
           at $Proxy9.deploy(Unknown Source)
           at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
           at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
           at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
           at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
           at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
           at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
           at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
           at java.lang.reflect.Method.invoke(Unknown Source)
           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
           at $Proxy0.start(Unknown Source)
           at org.jboss.system.ServiceController.start(ServiceController.java:417)
           at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
           at java.lang.reflect.Method.invoke(Unknown Source)
           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
           at $Proxy4.start(Unknown Source)
           at org.jboss.deployment.SARDeployer.start(SARDeployer.java:304)
           at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
           at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
           at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
           at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
           at java.lang.reflect.Method.invoke(Unknown Source)
           at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
           at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
           at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
           at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
           at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
           at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
           at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
           at $Proxy5.deploy(Unknown Source)
           at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
           at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
           at org.jboss.Main.boot(Main.java:200)
           at org.jboss.Main$1.run(Main.java:508)
           at java.lang.Thread.run(Unknown Source)
      Caused by: org.hibernate.InstantiationException: could not instantiate test objectorg.jboss.seam.wiki.core.model.WikiUploadImage
           at org.hibernate.engine.UnsavedValueFactory.instantiate(UnsavedValueFactory.java:48)
           at org.hibernate.engine.UnsavedValueFactory.getUnsavedIdentifierValue(UnsavedValueFactory.java:67)
           at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:67)
           at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:147)
           at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:457)
           at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:113)
           at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:87)
           at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:261)
           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:730)
           ... 145 more
      Caused by: java.lang.reflect.InvocationTargetException
           at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
           at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
           at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
           at java.lang.reflect.Constructor.newInstance(Unknown Source)
           at org.hibernate.engine.UnsavedValueFactory.instantiate(UnsavedValueFactory.java:45)
           ... 155 more
      Caused by: java.lang.Error: Unresolved compilation problem: 
           The annotation @ForeignKey is disallowed for this location
      
           at org.jboss.seam.wiki.core.model.WikiUploadImage.<init>(WikiUploadImage.java:7)
           ... 160 more