org.hibernate.MappingException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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.
    via by Pierre Fourès,
  • 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.
    via by Pierre Fourès,
  • 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
    via by Filippo Guerzoni,
  • 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
    via by Filippo Guerzoni,
  • The method AnnotationConfiguration.processFkSecondPassInOrder creates a Comparator that results in FkSecondPass objects being inadvertently removed from the secondPasses list due to an incorrect hashCode comparison. Lines 398 - 401 contain this comparison of hashCodes: else if ( f1.hashCode() == f2.hashCode() ) { compare = 0; } FkSecondPass uses Object.hashCode which has the JavaDoc comment: * As much as is reasonably practical, the hashCode method defined by * class <tt>Object</tt> does return distinct integers for distinct * objects. (This is typically implemented by converting the internal * address of the object into an integer, but this implementation * technique is not required by the * Java<font size="-2"><sup>TM</sup></font> programming language.) In my application I have seen random failures during startup of the application due to the fact that hashCodes for two FkSecondPass instances are the same, the result is that the FkSecondPass.secondPass method is never called and the FK is never bound, resulting in a error like: org.hibernate.MappingException: Foreign key (FK76A5E7CBCC5EDAA3:CLIENT [])) must have same number of columns as the referenced primary key (CLIENTAPPRC98BF18C [OBJECTID]) at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:90) at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:73) at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1263) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1170) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:316) at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115) at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1269) at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:150) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:888) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:416) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:126) As you can see the FK column on the owning table is empty (as TableBinder.bindFk is not called). This is a blocker for my application as I can not guarantee when the application will boot. It is entirely dependent on the memory state and implementation of the JVM as to whether or not a hashCode collision occurs. The patch is simple, a one-liner, to replace the hashCode comparison with an object equality comparison: else if ( f1 == f2 ) { compare = 0; } I have attached a patch for AnnotationConfiguration to fix this issue.
    via by Tim Smith,
  • db:: 3.33::Info: Silverlight Update 15.12.2010 98
    via by Unknown author,
  • The method AnnotationConfiguration.processFkSecondPassInOrder creates a Comparator that results in FkSecondPass objects being inadvertently removed from the secondPasses list due to an incorrect hashCode comparison. Lines 398 - 401 contain this comparison of hashCodes: else if ( f1.hashCode() == f2.hashCode() ) { compare = 0; } FkSecondPass uses Object.hashCode which has the JavaDoc comment: * As much as is reasonably practical, the hashCode method defined by * class <tt>Object</tt> does return distinct integers for distinct * objects. (This is typically implemented by converting the internal * address of the object into an integer, but this implementation * technique is not required by the * Java<font size="-2"><sup>TM</sup></font> programming language.) In my application I have seen random failures during startup of the application due to the fact that hashCodes for two FkSecondPass instances are the same, the result is that the FkSecondPass.secondPass method is never called and the FK is never bound, resulting in a error like: org.hibernate.MappingException: Foreign key (FK76A5E7CBCC5EDAA3:CLIENT [])) must have same number of columns as the referenced primary key (CLIENTAPPRC98BF18C [OBJECTID]) at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:90) at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:73) at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1263) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1170) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:316) at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115) at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1269) at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:150) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:888) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:416) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:126) As you can see the FK column on the owning table is empty (as TableBinder.bindFk is not called). This is a blocker for my application as I can not guarantee when the application will boot. It is entirely dependent on the memory state and implementation of the JVM as to whether or not a hashCode collision occurs. The patch is simple, a one-liner, to replace the hashCode comparison with an object equality comparison: else if ( f1 == f2 ) { compare = 0; } I have attached a patch for AnnotationConfiguration to fix this issue.
    via by Tim Smith,
  • Running Eureka Streams on Tomcat
    via by hsugka,
    • 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(ForeignKey.java:90) at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:73) at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1182) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1089) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:302) at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1034) at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1015) at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154) at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:751) at org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:350) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:119) at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264) 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.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:55) at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:107) at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66) at org.jboss.kernel.plugins.dependency.KernelControllerContextActions.dispatchJoinPoint(KernelControllerContextActions.java:100) at org.jboss.kernel.plugins.dependency.KernelControllerContextActions$LifecycleAction.installAction(KernelControllerContextActions.java:582) at org.jboss.kernel.plugins.dependency.KernelControllerContextActions$KernelControllerContextAction.install(KernelControllerContextActions.java:175) 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:91) at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:626) at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:475) at org.jboss.ejb3.embedded.EJB3StandaloneDeployer.start(EJB3StandaloneDeployer.java:460) at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.scanClasspath(EJB3StandaloneBootstrap.java:291) at fr.ifis.Main.main(Unknown Source)

    Users with the same issue

    Unknown visitor2 times, last one,
    Pilleo
    1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,