org.hibernate.MappingException: Association references unmapped class: G1

Hibernate JIRA | John J. Franey | 1 decade ago
  1. 0

    To reproduce: create new hsqldb database create tables (see DDL below) start eclipse create new workspace create new project create source directory import hsqldb.jar create hibernate configuration file create hibernate console (add hsqldb.jar to classpath) generate hibernate artifacts Exception dialog appears: here is <workspace>/.metadata/.log: !SESSION 2005-02-11 09:19:23.937 ----------------------------------------------- eclipse.buildId=I20041216-2000 java.version=1.4.2_06 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US Command-line arguments: -os linux -ws gtk -arch x86 !ENTRY org.hibernate.eclipse.console.HibernateConsolePlugin 4 4 2005-02-11 09:19:23.939 !MESSAGE Error under artifact generation !STACK 0 org.hibernate.MappingException: Association references unmapped class: G1 at org.hibernate.cfg.JDBCBinder.bindCollectionSecondPass(JDBCBinder.java:1178) at org.hibernate.cfg.JDBCBinder$CollectionSecondPass.secondPass(JDBCBinder.java:1201) at org.hibernate.cfg.HbmBinder$SecondPass.doSecondPass(HbmBinder.java:2052) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:830) at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:801) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard$3.execute(ArtifactGeneratorWizard.java:218) at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:76) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.buildConfiguration(ArtifactGeneratorWizard.java:210) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.doFinish(ArtifactGeneratorWizard.java:147) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.access$0(ArtifactGeneratorWizard.java:127) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard$1.run(ArtifactGeneratorWizard.java:95) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:105) Here is DDL: create table G0 ( AN_ID VARCHAR(20), CONSTRAINT "C0" PRIMARY KEY ("AN_ID") ); create table G1 ( AN_ID VARCHAR(20), CONSTRAINT "C1" FOREIGN KEY ("AN_ID") REFERENCES "G0" ); Here is hibernate config file generated by 'generate hib. conf.' step above: <hibernate-configuration> - <session-factory> <property name="hibernate.connection.username">sa</property> <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property> <property name="hibernate.connection.url">jdbc:hsqldb:hsql://localhost/t1db</property> <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property> </session-factory> </hibernate-configuration

    Hibernate JIRA | 1 decade ago | John J. Franey
    org.hibernate.MappingException: Association references unmapped class: G1
  2. 0

    To reproduce: create new hsqldb database create tables (see DDL below) start eclipse create new workspace create new project create source directory import hsqldb.jar create hibernate configuration file create hibernate console (add hsqldb.jar to classpath) generate hibernate artifacts Exception dialog appears: here is <workspace>/.metadata/.log: !SESSION 2005-02-11 09:19:23.937 ----------------------------------------------- eclipse.buildId=I20041216-2000 java.version=1.4.2_06 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US Command-line arguments: -os linux -ws gtk -arch x86 !ENTRY org.hibernate.eclipse.console.HibernateConsolePlugin 4 4 2005-02-11 09:19:23.939 !MESSAGE Error under artifact generation !STACK 0 org.hibernate.MappingException: Association references unmapped class: G1 at org.hibernate.cfg.JDBCBinder.bindCollectionSecondPass(JDBCBinder.java:1178) at org.hibernate.cfg.JDBCBinder$CollectionSecondPass.secondPass(JDBCBinder.java:1201) at org.hibernate.cfg.HbmBinder$SecondPass.doSecondPass(HbmBinder.java:2052) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:830) at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:801) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard$3.execute(ArtifactGeneratorWizard.java:218) at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:76) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.buildConfiguration(ArtifactGeneratorWizard.java:210) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.doFinish(ArtifactGeneratorWizard.java:147) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.access$0(ArtifactGeneratorWizard.java:127) at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard$1.run(ArtifactGeneratorWizard.java:95) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:105) Here is DDL: create table G0 ( AN_ID VARCHAR(20), CONSTRAINT "C0" PRIMARY KEY ("AN_ID") ); create table G1 ( AN_ID VARCHAR(20), CONSTRAINT "C1" FOREIGN KEY ("AN_ID") REFERENCES "G0" ); Here is hibernate config file generated by 'generate hib. conf.' step above: <hibernate-configuration> - <session-factory> <property name="hibernate.connection.username">sa</property> <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property> <property name="hibernate.connection.url">jdbc:hsqldb:hsql://localhost/t1db</property> <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property> </session-factory> </hibernate-configuration

    Hibernate JIRA | 1 decade ago | John J. Franey
    org.hibernate.MappingException: Association references unmapped class: G1
  3. 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])
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    org.hibernate.MappingException: Unable to find column with logical name

    Stack Overflow | 5 years ago | MahmoudS
    org.hibernate.MappingException: Unable to find column with logical name: medical_company_id in org.hibernate.mapping.Table(medical_company) and its related supertables and secondary tables
  6. 0

    Association references unmapped class hibernate

    Stack Overflow | 4 years ago | mahesh
    org.hibernate.MappingException: Association references unmapped class: com.infibeam.customerservice.dbObjects.AddressDO

    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

      Association references unmapped class: G1

      at org.hibernate.cfg.JDBCBinder.bindCollectionSecondPass()
    2. Hibernate
      Configuration.buildMappings
      1. org.hibernate.cfg.JDBCBinder.bindCollectionSecondPass(JDBCBinder.java:1178)
      2. org.hibernate.cfg.JDBCBinder$CollectionSecondPass.secondPass(JDBCBinder.java:1201)
      3. org.hibernate.cfg.HbmBinder$SecondPass.doSecondPass(HbmBinder.java:2052)
      4. org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:830)
      5. org.hibernate.cfg.Configuration.buildMappings(Configuration.java:801)
      5 frames
    3. org.hibernate.eclipse
      ArtifactGeneratorWizard$3.execute
      1. org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard$3.execute(ArtifactGeneratorWizard.java:218)
      1 frame
    4. org.hibernate.console
      ConsoleConfiguration.execute
      1. org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:76)
      1 frame
    5. org.hibernate.eclipse
      ArtifactGeneratorWizard$1.run
      1. org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.buildConfiguration(ArtifactGeneratorWizard.java:210)
      2. org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.doFinish(ArtifactGeneratorWizard.java:147)
      3. org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.access$0(ArtifactGeneratorWizard.java:127)
      4. org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard$1.run(ArtifactGeneratorWizard.java:95)
      4 frames
    6. JFace
      ModalContext$ModalContextThread.run
      1. org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:105)
      1 frame