org.hibernate.MappingException: Foreign key (FK6771BFAA1845E8B:CardField [])) must have same number of columns as the referenced primary key (Card [project_id])

Hibernate JIRA | Pierre Fourès | 1 decade ago
  1. 0

    As described in hibernate forum (http://forum.hibernate.org/viewtopic.php?t=960763) and discussed with Emmanuel, I encounter a strange behaviour with annotations depending of my package's names. Supposing hibernate load classes by package alphabetical order; if it get the "parent" class first all works fine, if it get the "child" class first, it raise an exception ! Here is a subset of my classes, cleaned of getters, setters and all unrelated things, then followed by the exception stack : /////////////////////////////////////////////// package fr.ifis.entity.field.card; import java.io.Serializable; import javax.persistence.Embeddable; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.ManyToOne; import fr.ifis.entity.project.Card; @Entity public class CardField { @Id private PrimaryKey primaryKey = new PrimaryKey(); // cardtmp is a trick used in order to wait for http://opensource.atlassian.com/projects/hibernate/browse/ANN-381 resolution @ManyToOne private Card cardtmp; @Embeddable private class PrimaryKey implements Serializable { @ManyToOne(optional = false) private Card card; @ManyToOne(optional = false) private CardKey key; } } /////////////////////////////////////////////// package fr.ifis.entity.field.card; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity public class CardKey { @Id @GeneratedValue private int id; } /////////////////////////////////////////////// package fr.ifis.entity.project; import java.io.Serializable; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Embeddable; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import fr.ifis.entity.field.card.CardField; @Entity public class Card { @Id private CardPrimaryKey primaryKey = new CardPrimaryKey(); @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER, mappedBy="cardtmp") // private Set<CardField> fields; @Embeddable private class CardPrimaryKey implements Serializable { @ManyToOne(optional = false) private Project project; //An other @ManyToOne is also present in the real model //The problem still occurs even when i remove this relation, it was no use to kept it for describe the problem } } /////////////////////////////////////////////// package fr.ifis.entity.project; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity public class Project { @Id @GeneratedValue private int id; } /////////////////////////////////////////////// [java] ERROR 29-06 19:42:18,272 (AbstractController.java:incrementState:350) -Error installing to Start: name=persistence.units:unitName=Refonte state=Create [java] org.hibernate.MappingException: Foreign key (FK6771BFAA1845E8B:CardField [])) must have same number of columns as the referenced primary key (Card [project_id]) [java] at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:90) [java] at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:73) [java] at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1182) [java] at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1089) [java] at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:302) [java] at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1034) [java] at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1015) [java] at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154) [java] at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:751) [java] at org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:350) [java] at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:119) [java] at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264) [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [java] at java.lang.reflect.Method.invoke(Method.java:585) [java] at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:55) [java] at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:107) [java] at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66) [java] at org.jboss.kernel.plugins.dependency.KernelControllerContextActions.dispatchJoinPoint(KernelControllerContextActions.java:100) [java] at org.jboss.kernel.plugins.dependency.KernelControllerContextActions$LifecycleAction.installAction(KernelControllerContextActions.java:582) [java] at org.jboss.kernel.plugins.dependency.KernelControllerContextActions$KernelControllerContextAction.install(KernelControllerContextActions.java:175) [java] at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) [java] at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:226) [java] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:593) [java] at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:346) [java] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:438) [java] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:379) [java] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:225) [java] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:151) [java] at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:79) [java] at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:73) [java] at org.jboss.ejb3.MCKernelAbstraction.install(MCKernelAbstraction.java:91) [java] at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:626) [java] at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:475) [java] at org.jboss.ejb3.embedded.EJB3StandaloneDeployer.start(EJB3StandaloneDeployer.java:460) [java] at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.scanClasspath(EJB3StandaloneBootstrap.java:291) [java] at fr.ifis.Main.main(Unknown Source) /////////////////////////////////////////////// Indeed, depending on the package names I get or not an excpetion ! It doesn't work with the package fr.ifis.entity.project but if I rename the package in fr.ifis.entity.aproject and then move it "before" the field.card package, all works fine. In order to facilitate the identification of the problem, I also include as attachement the eclipse project of this problem repport. In order to keep reasonable the size of the attachement, I did not included the libraries nor the configuration files for launch ejb3-embedded. Thoses files are issued from the project simple-deployment included in JBoss EJB 3.0 RC8-FD. The only change i've done was to specify in embedded-jboss-beans.xml the properties of my database. Regards, Pierre.

    Hibernate JIRA | 1 decade ago | Pierre Fourès
    org.hibernate.MappingException: Foreign key (FK6771BFAA1845E8B:CardField [])) must have same number of columns as the referenced primary key (Card [project_id])
  2. 0

    As described in hibernate forum (http://forum.hibernate.org/viewtopic.php?t=960763) and discussed with Emmanuel, I encounter a strange behaviour with annotations depending of my package's names. Supposing hibernate load classes by package alphabetical order; if it get the "parent" class first all works fine, if it get the "child" class first, it raise an exception ! Here is a subset of my classes, cleaned of getters, setters and all unrelated things, then followed by the exception stack : /////////////////////////////////////////////// package fr.ifis.entity.field.card; import java.io.Serializable; import javax.persistence.Embeddable; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.ManyToOne; import fr.ifis.entity.project.Card; @Entity public class CardField { @Id private PrimaryKey primaryKey = new PrimaryKey(); // cardtmp is a trick used in order to wait for http://opensource.atlassian.com/projects/hibernate/browse/ANN-381 resolution @ManyToOne private Card cardtmp; @Embeddable private class PrimaryKey implements Serializable { @ManyToOne(optional = false) private Card card; @ManyToOne(optional = false) private CardKey key; } } /////////////////////////////////////////////// package fr.ifis.entity.field.card; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity public class CardKey { @Id @GeneratedValue private int id; } /////////////////////////////////////////////// package fr.ifis.entity.project; import java.io.Serializable; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Embeddable; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import fr.ifis.entity.field.card.CardField; @Entity public class Card { @Id private CardPrimaryKey primaryKey = new CardPrimaryKey(); @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER, mappedBy="cardtmp") // private Set<CardField> fields; @Embeddable private class CardPrimaryKey implements Serializable { @ManyToOne(optional = false) private Project project; //An other @ManyToOne is also present in the real model //The problem still occurs even when i remove this relation, it was no use to kept it for describe the problem } } /////////////////////////////////////////////// package fr.ifis.entity.project; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity public class Project { @Id @GeneratedValue private int id; } /////////////////////////////////////////////// [java] ERROR 29-06 19:42:18,272 (AbstractController.java:incrementState:350) -Error installing to Start: name=persistence.units:unitName=Refonte state=Create [java] org.hibernate.MappingException: Foreign key (FK6771BFAA1845E8B:CardField [])) must have same number of columns as the referenced primary key (Card [project_id]) [java] at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:90) [java] at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:73) [java] at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1182) [java] at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1089) [java] at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:302) [java] at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1034) [java] at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1015) [java] at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154) [java] at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:751) [java] at org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:350) [java] at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:119) [java] at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264) [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [java] at java.lang.reflect.Method.invoke(Method.java:585) [java] at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:55) [java] at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:107) [java] at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66) [java] at org.jboss.kernel.plugins.dependency.KernelControllerContextActions.dispatchJoinPoint(KernelControllerContextActions.java:100) [java] at org.jboss.kernel.plugins.dependency.KernelControllerContextActions$LifecycleAction.installAction(KernelControllerContextActions.java:582) [java] at org.jboss.kernel.plugins.dependency.KernelControllerContextActions$KernelControllerContextAction.install(KernelControllerContextActions.java:175) [java] at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) [java] at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:226) [java] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:593) [java] at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:346) [java] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:438) [java] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:379) [java] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:225) [java] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:151) [java] at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:79) [java] at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:73) [java] at org.jboss.ejb3.MCKernelAbstraction.install(MCKernelAbstraction.java:91) [java] at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:626) [java] at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:475) [java] at org.jboss.ejb3.embedded.EJB3StandaloneDeployer.start(EJB3StandaloneDeployer.java:460) [java] at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.scanClasspath(EJB3StandaloneBootstrap.java:291) [java] at fr.ifis.Main.main(Unknown Source) /////////////////////////////////////////////// Indeed, depending on the package names I get or not an excpetion ! It doesn't work with the package fr.ifis.entity.project but if I rename the package in fr.ifis.entity.aproject and then move it "before" the field.card package, all works fine. In order to facilitate the identification of the problem, I also include as attachement the eclipse project of this problem repport. In order to keep reasonable the size of the attachement, I did not included the libraries nor the configuration files for launch ejb3-embedded. Thoses files are issued from the project simple-deployment included in JBoss EJB 3.0 RC8-FD. The only change i've done was to specify in embedded-jboss-beans.xml the properties of my database. Regards, Pierre.

    Hibernate JIRA | 1 decade ago | Pierre Fourès
    org.hibernate.MappingException: Foreign key (FK6771BFAA1845E8B:CardField [])) must have same number of columns as the referenced primary key (Card [project_id])
  3. 0

    Hello, When using together @CollectionOfElements(fetch= FetchType.EAGER) @Where(clause="state='A'") @JoinTable(name = "functions_loglev", joinColumns = @JoinColumn(name = "id")) I'm exeperiencing the following MappingException that doesn't occur when using FetchType.LAZY ERROR 11-03 09:46:26,890 (AbstractController.java:incrementState:350) -Error installing to Start: name=persistence.units:jar=Prototype.jar,unitName=logdb state=Create org.hibernate.MappingException: @ManyToMany defining filter or where without join fetching not valid within collection using join fetching[model.strutcture.functions.levels] at org.hibernate.cfg.annotations.CollectionBinder.checkFilterConditions(CollectionBinder.java:863) at org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:849) at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:421) at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:382) at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:35) at org.hibernate.cfg.annotations.CollectionBinder.bind(CollectionBinder.java:331) at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1296) at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:629) at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:276) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:210) at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:997) at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:722) at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:161) at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:567) at org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:245) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:108) at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:260) 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:585) at org.jboss.joinpoint.plugins.reflect.ReflectMethodJoinPoint.dispatch(ReflectMethodJoinPoint.java:72) at org.jboss.kernel.plugins.dependency.KernelControllerContextActions.dispatchJoinPoint(KernelControllerContextActions.java:96) at org.jboss.kernel.plugins.dependency.KernelControllerContextActions$LifecycleAction.installAction(KernelControllerContextActions.java:476) at org.jboss.kernel.plugins.dependency.KernelControllerContextActions$KernelControllerContextAction.install(KernelControllerContextActions.java:171) at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:226) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:593) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:346) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:438) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:379) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:225) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:151) at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:79) at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:73) at org.jboss.ejb3.MCKernelAbstraction.install(MCKernelAbstraction.java:86) at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:599) at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:452) at org.jboss.ejb3.embedded.EJB3StandaloneDeployer.start(EJB3StandaloneDeployer.java:450) at AllModelTests.startupEmbeddedJboss(AllModelTests.java:49) at AllModelTests$1.setUp(AllModelTests.java:25) at junit.extensions.TestSetup$1.protect(TestSetup.java:18) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.extensions.TestSetup.run(TestSetup.java:23) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Deleting the @WHERE annotation the Exception disappears. I can't understand it at all. Why the stack trace refers to manytomany? It's a simple composition of elements. Thanks in advance. F Hibernate version: 3.1 with annotations beta8

    Hibernate JIRA | 1 decade ago | Filippo Guerzoni
    org.hibernate.MappingException: @ManyToMany defining filter or where without join fetching not valid within collection using join fetching[model.strutcture.functions.levels]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Hello, When using together @CollectionOfElements(fetch= FetchType.EAGER) @Where(clause="state='A'") @JoinTable(name = "functions_loglev", joinColumns = @JoinColumn(name = "id")) I'm exeperiencing the following MappingException that doesn't occur when using FetchType.LAZY ERROR 11-03 09:46:26,890 (AbstractController.java:incrementState:350) -Error installing to Start: name=persistence.units:jar=Prototype.jar,unitName=logdb state=Create org.hibernate.MappingException: @ManyToMany defining filter or where without join fetching not valid within collection using join fetching[model.strutcture.functions.levels] at org.hibernate.cfg.annotations.CollectionBinder.checkFilterConditions(CollectionBinder.java:863) at org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:849) at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:421) at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:382) at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:35) at org.hibernate.cfg.annotations.CollectionBinder.bind(CollectionBinder.java:331) at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1296) at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:629) at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:276) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:210) at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:997) at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:722) at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:161) at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:567) at org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:245) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:108) at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:260) 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:585) at org.jboss.joinpoint.plugins.reflect.ReflectMethodJoinPoint.dispatch(ReflectMethodJoinPoint.java:72) at org.jboss.kernel.plugins.dependency.KernelControllerContextActions.dispatchJoinPoint(KernelControllerContextActions.java:96) at org.jboss.kernel.plugins.dependency.KernelControllerContextActions$LifecycleAction.installAction(KernelControllerContextActions.java:476) at org.jboss.kernel.plugins.dependency.KernelControllerContextActions$KernelControllerContextAction.install(KernelControllerContextActions.java:171) at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:226) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:593) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:346) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:438) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:379) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:225) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:151) at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:79) at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:73) at org.jboss.ejb3.MCKernelAbstraction.install(MCKernelAbstraction.java:86) at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:599) at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:452) at org.jboss.ejb3.embedded.EJB3StandaloneDeployer.start(EJB3StandaloneDeployer.java:450) at AllModelTests.startupEmbeddedJboss(AllModelTests.java:49) at AllModelTests$1.setUp(AllModelTests.java:25) at junit.extensions.TestSetup$1.protect(TestSetup.java:18) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.extensions.TestSetup.run(TestSetup.java:23) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Deleting the @WHERE annotation the Exception disappears. I can't understand it at all. Why the stack trace refers to manytomany? It's a simple composition of elements. Thanks in advance. F Hibernate version: 3.1 with annotations beta8

    Hibernate JIRA | 1 decade ago | Filippo Guerzoni
    org.hibernate.MappingException: @ManyToMany defining filter or where without join fetching not valid within collection using join fetching[model.strutcture.functions.levels]
  6. 0

    Upgrade Spring (2.5.5 to 4.0.2) and hibernate (3.2.6 to 3.6.9) version

    Stack Overflow | 2 years ago | sanitg
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [spring/test-persistenceContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Foreign key (FKEC0DF9EF331D3E16:CLIENT_ACCOUNT_SERVICE [ACCT_ID,ACCT_PTY_STA_TYP,ACCT_ROLE_TYP,ACCT_STA_TYP,PTY_ID,PTY_ROLE_TYP,PTY_STA_TYP])) must have same number of columns as the referenced primary key (ACCOUNT_PARTY [ACCT_ID,ACCT_PTY_STA_TYP,ACCT_ROLE_TYP,PTY_ID,PTY_ROLE_TYP,PTY_STA_TYP])

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.hibernate.MappingException

      Foreign key (FK6771BFAA1845E8B:CardField [])) must have same number of columns as the referenced primary key (Card [project_id])

      at org.hibernate.mapping.ForeignKey.alignColumns()
    2. Hibernate
      Configuration.buildMappings
      1. org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:90)
      2. org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:73)
      3. org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1182)
      4. org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1089)
      5. org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:302)
      6. org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1034)
      6 frames
    3. Hibernate EJB
      HibernatePersistence.createContainerEntityManagerFactory
      1. org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1015)
      2. org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154)
      3. org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:751)
      4. org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:350)
      5. org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:119)
      5 frames
    4. org.jboss.ejb3
      PersistenceUnitDeployment.start
      1. org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264)
      1 frame
    5. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:585)
      4 frames
    6. JBoss Reflection
      BasicMethodJoinPoint.dispatch
      1. org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:55)
      2. org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:107)
      3. org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
      3 frames
    7. JBoss Microcontainer Kernel
      KernelControllerContextActions$KernelControllerContextAction.install
      1. org.jboss.kernel.plugins.dependency.KernelControllerContextActions.dispatchJoinPoint(KernelControllerContextActions.java:100)
      2. org.jboss.kernel.plugins.dependency.KernelControllerContextActions$LifecycleAction.installAction(KernelControllerContextActions.java:582)
      3. org.jboss.kernel.plugins.dependency.KernelControllerContextActions$KernelControllerContextAction.install(KernelControllerContextActions.java:175)
      3 frames
    8. JBoss Microcontainer Dependency
      AbstractController.install
      1. org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
      2. org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:226)
      3. org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:593)
      4. org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:346)
      5. org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:438)
      6. org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:379)
      7. org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:225)
      8. org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:151)
      8 frames
    9. JBoss Microcontainer Kernel
      AbstractKernelController.install
      1. org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:79)
      2. org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:73)
      2 frames
    10. org.jboss.ejb3
      EJB3StandaloneBootstrap.scanClasspath
      1. org.jboss.ejb3.MCKernelAbstraction.install(MCKernelAbstraction.java:91)
      2. org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:626)
      3. org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:475)
      4. org.jboss.ejb3.embedded.EJB3StandaloneDeployer.start(EJB3StandaloneDeployer.java:460)
      5. org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.scanClasspath(EJB3StandaloneBootstrap.java:291)
      5 frames
    11. fr.ifis
      Main.main
      1. fr.ifis.Main.main(Unknown Source)
      1 frame