facebook

MappingException: Foreign key

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #236673 Reply

    ijgomez
    Member

    Hi,

    Im using MyEclipse (last version aviable) from programming with Hibernate 3, and when I tray tu use the Object HibernateSession. This exception is launch by the Tomcat:

    
    %%%% Error Creating SessionFactory %%%%
    org.hibernate.MappingException: Foreign key (FK7089409D6A199C:TABLE_A [COLUMN_B])) must have same number of columns as the referenced primary key (SIGMAT_MEDIDA_PUME_15 [COLUMN_A,COLUMN_B,COLUMN_C,COLUMN_D,COLUMN_E])
        at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:86)
        at org.hibernate.mapping.ForeignKey.setReferencedTable(ForeignKey.java:51)
        at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:976)
        at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:921)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:999)
        at es.indra.sigma.hibernate.HibernateSessionFactory.currentSession(HibernateSessionFactory.java:51)
    ....
    

    Im using the *.class and *.xml that MyEclise generated, and i dont modific.

    Please, Anybody, Cant Help me?

    #236693 Reply

    Riyad Kalla
    Member

    It looks like you changed some mappings without updating others or you have defined a foregin key incorrectly that defined less/more number of columsn than the PK of the table you are referencing. Have you tried regenerating your mappings?

    #236699 Reply

    ijgomez
    Member

    Im tried regenerating 6 times the mapping files, and the result is the same, and the exception is activited.

    Cant Help me?

    #236716 Reply

    Riyad Kalla
    Member

    Can you post the table schema from the table with the PK and the table with the FK referring to it, as well as the generated hbm.xml files.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: MappingException: Foreign key

You must be logged in to post in the forum log in