-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate Foreign Key Mapping Excception
PostPosted: Thu Jun 30, 2005 12:27 am 
Newbie

Joined: Fri Jun 10, 2005 6:30 am
Posts: 4
Location: Bangalore,India
http://worg.hibernate.MappingException: Foreign key (FK79D994BA24E43F9A:BILLING_COMPONENT [SALARY_ACCOUNT_NO])) must have same number of columns as the referenced primary key (VENDOR_ACCOUNT [VENDOR_ID,SALARY_ACCOUNT_NO])
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:940)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:888)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1036)ww.hibernate.org/ForumMailinglists/HowToAskForHelp

Hi Guyz,

I have been trying 2 solve the above error for quite some time......I have 3 Table "Billing_Component","vendor" & "Vendor_Account".

The Primary key in "Vendor" is "VENDOR_ID"..Which in turn is a foreign key in both "Billing_Component" & "Vendor_Account".

In other words....."vendor" has a many-to-one relation with "Vendor" & a one-to-many with "Billing_Component".

"Billing_Component" table also has a many-to-one with "vendor".

Now when I generate the HBMS for all this tables......& try to start my tomcat....The above stated error is generated.

The many-to-one mapping for "Vendor_Account" in "Billing_Component"...mentions only the COLUMN "SALARY_ACCOUNT_NO".....Hence this prob...If I explicitly mention COLUMN "VENDOR_ID" ..Then this prob is solved but I get the "Duplication column exception-put insert="false" & update="false" in Billing_Component table.

I read some where this is a Bug....Any solutions???


Top
 Profile  
 
 Post subject: Re: Hibernate Foreign Key Mapping Excception
PostPosted: Thu Jun 30, 2005 12:31 am 
Newbie

Joined: Fri Jun 10, 2005 6:30 am
Posts: 4
Location: Bangalore,India
abhi_amon wrote:
http://worg.hibernate.MappingException: Foreign key (FK79D994BA24E43F9A:BILLING_COMPONENT [SALARY_ACCOUNT_NO])) must have same number of columns as the referenced primary key (VENDOR_ACCOUNT [VENDOR_ID,SALARY_ACCOUNT_NO])
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:940)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:888)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1036)ww.hibernate.org/ForumMailinglists/HowToAskForHelp

Hi Guyz,

I have been trying 2 solve the above error for quite some time......I have 3 Table "Billing_Component","vendor" & "Vendor_Account".

The Primary key in "Vendor" is "VENDOR_ID"..Which in turn is a foreign key in both "Billing_Component" & "Vendor_Account".

In other words....."Vendor_Account" has a many-to-one relation with "Vendor" & a one-to-many with "Billing_Component".

"Billing_Component" table also has a many-to-one with "vendor".

Now when I generate the HBMS for all this tables......& try to start my tomcat....The above stated error is generated.

The many-to-one mapping for "Vendor_Account" in "Billing_Component"...mentions only the COLUMN "SALARY_ACCOUNT_NO".....Hence this prob...If I explicitly mention COLUMN "VENDOR_ID" ..Then this prob is solved but I get the "Duplication column exception-put insert="false" & update="false" in Billing_Component table.

I read some where this is a Bug....Any solutions???


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.