Issue Details (XML | Word | Printable)

Key: NUCRDBMS-727
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Andy Jefferson
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Store RDBMS

Should allow M-N ordered lists but currently dont

Created: 20/Dec/13 12:39 PM   Updated: 21/Dec/13 11:37 AM   Resolved: 20/Dec/13 04:01 PM
Component/s: ORM
Affects Version/s: None
Fix Version/s: 3.2.10


 Description  « Hide
We currently only support M-N relations for Sets since lists were traditionally indexed only (and it makes no sense at all to have a M-N indexed list relation, since there would have to be 2 indexes in the join table, and inserting would be a nightmare to set both index positions). In principle an ordered List should be usable as an M-N relation. The problem with this currently is that JoinListStore has no logic to not persist duplicates (one from each side) whereas JoinSetStore does have some logic for this.

Andy Jefferson made changes - 20/Dec/13 04:00 PM
Field Original Value New Value
Summary Persist of M-N relation is inefficient and likely should just persist from the owner side, should be usable by ordered Lists too Should allow M-N ordered lists but currently dont
Description We currently only support M-N relations for Sets since lists were traditionally indexed only (and it makes no sense at all to have a M-N indexed list relation, since there would have to be 2 indexes in the join table, and inserting would be a nightmare to set both index positions). In principle an ordered List should be usable as an M-N relation. The problem with this currently is that JoinListStore has no logic to not persist duplicates (one from each side) whereas JoinSetStore does have some logic for this.

Secondly the logic that is in JoinSetStore for preventing duplicates is inefficient and we could likely overcome all of these problem areas by just allowing an M-N relation to be inserted from the owner side (and any call on the non-owner side would be a no-op).
We currently only support M-N relations for Sets since lists were traditionally indexed only (and it makes no sense at all to have a M-N indexed list relation, since there would have to be 2 indexes in the join table, and inserting would be a nightmare to set both index positions). In principle an ordered List should be usable as an M-N relation. The problem with this currently is that JoinListStore has no logic to not persist duplicates (one from each side) whereas JoinSetStore does have some logic for this.
Andy Jefferson added a comment - 20/Dec/13 04:01 PM
GitHub master has code to prevent dups in ordered lists by only persisting from the owner side of the M-N. Simple test added to GutHub, and outline docs added.

Andy Jefferson made changes - 20/Dec/13 04:01 PM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 3.2.10 [ 12061 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 21/Dec/13 11:37 AM
Status Resolved [ 5 ] Closed [ 6 ]