[OJB-developers] MtoN-followup
Brought to you by:
thma
From: Georg S. <ge...@me...> - 2002-06-06 11:51:01
|
Hi Jacob and Thomas This is the follow-up to my previous mail talking about the M:N-Relationship issue: OK, the basic issue is, that an object should be able to form part of different collections. The basic example I give is that you could have an Inventory object which contains a list of Articles, and ShoppingCart objects which also contain a list of Articles. I don't think that this is a minor feature, but it is simply the way objects can be used in Java. Up to the last release this was possible, but now the entire MtoN-code has been changed. Now an object A can have a collection of objects B, but at the same time object B has to have a collection of objects A, effectively linking A and B tightly together. If you want to have object A to be part of a collection in an object C, you have to provide a collection in object B pointing to objects C ..... Object B shouldn't have to know that it is part of a collection in an M:N scenario. The only testcase for that MtoN-issue is testMNLoading() in MtoNMapping which uses the Person-Project relationship, where Person has a collection of Projects and Project has a collection of Persons. I have assembled a testcase which should check the form of MtoN-relationships where the N-Class doesn't have a collection of M-Objects. Of course it fails right away, but it would be a starting point to analyze how to fix things. I have attached the following things: 1.) a method testMultipleMtoNRelations() which should go into the MtoNMapping.java file 2.) the files Inventory.java and ShoppingCart.java which go into the same directory 3.) the mapping for both classes which has to be added to repository_junit.xml 4.) the create statement for the tables and indirection tables which has to go into db-setup.sql Cheers Georg |