net.sf.hibernate.MappingException: broken column mapping for: expirationDate

Hibernate JIRA | John Kristian | 1 decade ago
  1. Speed up your debug routine!

    Automated exception search integrated into your IDE

  2. 0

    I have two tables, QWB_EXTRCT_VW_CLMN and QWB_FLDR_CLMN. QWB_EXTRCT_VW_CLMN has a composite primary key with columns EXTRCT_VW_NUM and FLDR_CLMN_NUM, FLDR_CLMN_NUM being a foreign key to the (single) primary key of the QWB_FLDR_CLMN table. Middlegen generates the following mapping for QwbFldrClmn: <composite-id name="comp_id" class="testQwb.hibernate.persistent.QwbExtrctVwClmnPK"> <meta attribute="field-description"> generator-class="assigned" </meta> <!-- uni-directional one-to-one association to QwbFldrClmn --> <key-many-to-one name="qwbFldrClmn" class="testQwb.hibernate.persistent.QwbFldrClmn" > <column name="FLDR_CLMN_NUM" /> </key-many-to-one> <!-- bi-directional many-to-one association to QwbExtrctVw --> <key-many-to-one name="qwbExtrctVw" class="testQwb.hibernate.persistent.QwbExtrctVw" > <column name="EXTRCT_VW_NUM" /> </key-many-to-one> </composite-id> However when run the following exception is thrown: net.sf.hibernate.MappingException: Foreign key (QWB_EXTRCT_VW_CLMN [FLDR_CLMN_NUM])) must have same number of columns as the reference primary key (QWB_FLDR_CLMN [FLDR_NUM,FLDR_CLMN_NUM]) at net.sf.hibernate.mapping.ForeignKey.setReferencedTable( at net.sf.hibernate.cfg.Configuration.secondPassCompile( at net.sf.hibernate.cfg.Configuration.buildSessionFactory( at org.ifmc.qw.hibernate.HibernateSession.init( at testQwb.hibernate.TestHibernate3.main( Note that this xml works with the 2.1 beta 6, but not with RC1. Is Middlegen not putting something in? BTW in general I am having a heck of a time migrating from 2.1 Beta 6 to RC1 using Middlegen created XML files. Seems to me to be a good idea to do more testing with Middlegen and Hibernate to make sure the generated files work. Or else modify Hibernate or Middlegen so they would cooperate better. Also please note that this is NOT the same problem as with HB-512, I am already using the patched code but yet I now have this new error. Thanks, Daniel

    Hibernate JIRA | 1 decade ago | Daniel Rosenbaum
    net.sf.hibernate.MappingException: Foreign key (QWB_EXTRCT_VW_CLMN [FLDR_CLMN_NUM])) must have same number of columns as the reference primary key (QWB_FLDR_CLMN [FLDR_NUM,FLDR_CLMN_NUM])

    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. net.sf.hibernate.MappingException

      broken column mapping for: expirationDate

      at net.sf.hibernate.persister.AbstractPropertyMapping.initPropertyPaths()
    2. net.sf.hibernate
      1. net.sf.hibernate.persister.AbstractPropertyMapping.initPropertyPaths(
      2. net.sf.hibernate.persister.AbstractEntityPersister.initPropertyPaths(
      3. net.sf.hibernate.persister.EntityPersister.postInstantiate(
      4. net.sf.hibernate.impl.SessionFactoryImpl.<init>(
      5. net.sf.hibernate.cfg.Configuration.buildSessionFactory(
      5 frames
    3. com.docent.lms
      1. com.docent.lms.core.TransactionMgr.<init>(
      1 frame