[forge-issues] [JBoss JIRA] (FORGE-911) Scaffolding from a Join table with more than two primary key columns is not supported

Hanine Hanynowsky (JIRA) jira-events at lists.jboss.org
Sun Oct 27 05:56:02 EDT 2013


    [ https://issues.jboss.org/browse/FORGE-911?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12825208#comment-12825208 ] 

Hanine Hanynowsky edited comment on FORGE-911 at 10/27/13 5:55 AM:
-------------------------------------------------------------------

Hi Reynolds! Sorry for the delay!
In the screenshot above, there are two tables (Expertise & Book) having a M-2-M identifying relationship; yet the Expertise table has a composite primary key, which involves the join table having also 3 primary keys.

Hibernate seems to be unable to handle this kind of join tables as it expects only 2 primary key columns and hence fires the following exception error message:

"org.hibernate.AnnotationException: A Foreign key refering org.otika.prototype.model.Expertise from org.otika.prototype.model.Book has the wrong number of column. should be 2".

I would probably test this use case againt JPA through EclipseLink and check whether the same error is reproduced, since I am not sure whether it's Hibernate core or forge scaffolfing being responsible of that issue!
                
      was (Author: hanynowsky):
    Hi Reynolds! Dorry for the delay!
In the screenshot above, there are two tables (Expertise & Book) having a M-2-M identifying relationship; yet the Expertise table has a composite primary key, which involves the join table having also 3 primary keys.

Hibernate seems to be unable to handle this kind of join tables as it expects only 2 primary key columns and hence fires the following exception error message:

"org.hibernate.AnnotationException: A Foreign key refering org.otika.prototype.model.Expertise from org.otika.prototype.model.Book has the wrong number of column. should be 2".

I would probably test this use case againt JPA through EclipseLink and check whether the same error is reproduced, since I am not sure whether it's Hibernate core or forge scaffolfing being responsible of that issue!
                  
> Scaffolding from a Join table with more than two primary key columns is not supported
> -------------------------------------------------------------------------------------
>
>                 Key: FORGE-911
>                 URL: https://issues.jboss.org/browse/FORGE-911
>             Project: Forge
>          Issue Type: Feature Request
>          Components: Scaffold
>    Affects Versions: 1.2.3.Final, 1.3.0.Final
>         Environment: Linux 3.8 - Firefox - MySQL 5.5 - PostgreSQl 9.1
>            Reporter: Hanine Hanynowsky
>            Assignee: Vineet Reynolds
>             Fix For: 1.x Future
>
>
> Using JForge (latest version); one will have a hibernate error complaining about the M2M join table (linking two objects) having more than 2 key columns.
> Naturally, if you join a table with one key column with a another table with a composite primary key (two columns key), in order to get a Many to Many  relationship, you'll end up with a join table that has three key columns.
>  
> When Forge finished scaffolding no error is displayed. You get the error when deploying to the container (JBoss as 7.1.1 for example). And the app is not deployed (rolled back).
>  
> Is this a bug? A feature request?
>  
> It seems to me that with the EmbeddedId bug, this one is also serious stuff!!

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the forge-issues mailing list