![]() |
![]() |
|
[
Permalink
| « Hide
]
Andy Jefferson added a comment - 24/Aug/05 07:11 PM
Schema generation (table, and constraint) now works for the join table collection case - the multiple owner tables are created, with the single join table, and element table, and FK's are added between all relevant id columns.
JPOX CVS now supports collection fields that have elements using "subclass-table" and where there is no more than 1 subclass table storing the elements
This being the case, can we thrown an exception when more than 1 class extends the superclass where subclass-table is used and the superclass contains a collection? Currently the Enhancer completes fine, and the schema tool does not complain either. Yet at runtime if your lucky your program will fail quickly.
Also is there some difficulty is simply supporting this? Can't collection fields be put into the subclass just like ordinary fields? Manpower issue? > Can we throw an exception?
We can if someone has time to write the check to do that. Provide a patch ? > Is there some difficulty providing this ? Yes. Technical, and Manpower. Think about what the tables will look like with inheritance (at both ends) and then think about the queries that would have to be fired off to find elements in the collection (and how efficient they would be!). Go through the "org.jpox.store.rdbms.scostore" classes and see the TODOs. With the original backing stores the query to get the iterator of elements would have been
SELECT THIS.xxx FROM SUB1 THIS WHERE THIS.OWNER_ID = val UNION SELECT THIS_1.xxx FROM SUB2 THIS INNER JOIN SUB1 THIS_1 ON THIS_1.xxx = THIS.xxx WHERE THIS.OWNER_ID = val With the rewritten (SQL API) backing store the same iterator query becomes SELECT 'mydomain.Sub2' AS NUCLEUS_TYPE,A0."NAME",A0.SUB2_ID FROM SUB2 A0 WHERE A0.OWNER_ID = val UNION SELECT 'mydomain.Sub1' AS NUCLEUS_TYPE,A0."NAME",A0.SUB2_ID FROM SUB1 A0 WHERE A0.OWNER_ID = val So it is more correct now, but unfortunately gets the "id" field name incorrect since should be selecting columns of SUB1 in the first part of the union, and columns of SUB2 in the second part of the union. The size() query and many other queries still have TODOs for anyone interested The query iterator for elements is now correct in SVN trunk for the case of FK set. Also elements are now correctly inserted for that case.
|
||||||||||||||||||||||||||||||||