Double Many to Many
chrismalan Feb 8, 2006 4:02 AMThis is a somewhat unusual scenario. There are persons both working for this concern and persons who are clients. They share the same database table. Then there are different groups of people. Among the staff they can be admin staff and social workers and what have you. Among the clients they can be any of a number of groups, pensioners, jobless people, substance abusers, etc.
Any person can be a member of any number of groups. Then any number of staffmembers can be responsible for any number of groups.
So, we have two m-m relationships:
person -- group as a member
person -- group as the owner of one or more groups
One m-m relationship between two tables work fine, but when I define the second one (the two relationship tables have different names, of course) I get null pointer exceptions.
impl19:34:24,082 INFO [Configuration] processing collection mappings 19:34:24,131 WARN [ServiceController] Problem creating service jboss.j2ee:service=EJB3,module=nfss.par java.lang.NullPointerException at org.hibernate.cfg.annotations.TableBinder.bindFk(TableBinder.java:104) at org.hibernate.cfg.annotations.CollectionBinder.bindCollectionSecondPass(CollectionBinder.java:877) ements Serializable
After a long stack trace comes:
implement at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:182) 19:34:24,374 INFO [EJB3Deployer] Deployed: file:/usr/local/jboss-4.0.3/server/default/deploy/nfss.par 19:34:24,376 ERROR [URLDeploymentScanner] Incomplete Deployment listing: --- MBeans waiting for other MBeans --- ObjectName: jboss.j2ee:service=EJB3,module=nfss.par State: FAILED Reason: java.lang.NullPointerException --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM --- ObjectName: jboss.j2ee:service=EJB3,module=nfss.par State: FAILED Reason: java.lang.NullPointerException s Serializable
Removing one of the m-m relationships solves the problem. I tried it from both sides - the relationship tables defined in different classes for the two relationships and then defining the relationship tables in the same class for the two relationships. No go.
Can this be done? It should be possible.
I user jBoss 4.0.3 and jBossIDE-1.5 and JDK 1.5.0.01
Thanks,