[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
Tue May 21 10:15:07 EDT 2013


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

Hanine Hanynowsky commented on FORGE-911:
-----------------------------------------

I tested with 1.3.0 some minutes ago ad the bug is still present:

You get this exception when you deploy : 

15:00:28,231 WARN  [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-4) HHH000059: Defining hibernate.transaction.flush_before_completion=true ignored in HEM
15:00:28,267 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.persistenceunit."prototype.war#forge-default": org.jboss.msc.service.StartException in service jboss.persistenceunit."prototype.war#forge-default": Failed to start service
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_11]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_11]
	at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_11]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: forge-default] Unable to build EntityManagerFactory
	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914)
	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889)
	at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
	at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162)
	at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
	... 3 more
Caused by: 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
	at org.hibernate.cfg.annotations.TableBinder.bindFk(TableBinder.java:432)
	at org.hibernate.cfg.annotations.CollectionBinder.bindManytoManyInverseFk(CollectionBinder.java:1502)
	at org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:1403)
	at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:691)
	at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:626)
	at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:66)
	at org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1586)
	at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1359)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1724)
	at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84)
	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)
	... 9 more

15:00:28,477 INFO  [org.jboss.as.server] (management-handler-thread - 4) JBAS015870: Deploy of deployment "prototype.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"prototype.war#forge-default\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"prototype.war#forge-default\": Failed to start service"}}
15:00:28,489 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-10) JBAS015877: Stopped deployment prototype.war in 12ms
15:00:28,489 INFO  [org.jboss.as.controller] (management-handler-thread - 4) JBAS014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.persistenceunit."prototype.war#forge-default": org.jboss.msc.service.StartException in service jboss.persistenceunit."prototype.war#forge-default": Failed to start service



As for the EmbeddedId bug, i don't know if it's been filed yet or not but here is the Forum thread: https://community.jboss.org/thread/206517?tstart=30

If it happens that an entity has an EmbeddedId (composite primary key) as type of it id, the view layer will fail handling it (It creates null id). The user cannot create an object with EmbeddedId, nor view it.

Could you confirm please that the EmbeddedId bug is not yet filed?
                
> 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: Story
>          Components: Scaffold
>    Affects Versions: 1.2.3.Final
>         Environment: Linux 3.8 - Firefox - MySQL 5.5 - PostgreSQl 9.1
>            Reporter: Hanine Hanynowsky
>
> 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