Issue Details (XML | Word | Printable)

Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Andy Jefferson
Votes: 0
Watchers: 2

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

1-1 undirectional relation needs the flexibility of allowing "subclass-table" at the other end

Created: 21/Aug/05 12:34 PM   Updated: 07/Apr/15 09:33 AM   Resolved: 06/Apr/15 01:31 PM
Component/s: ORM
Affects Version/s: None
Fix Version/s: 4.1.0.m4

 Description  « Hide
If we have the following classes
class Reader
    MediaWork media;
abstract class MediaWork
    String name;
class Newspaper extends MediaWork
    String editor;
class Magazine extends MediaWork
    int frequency;
where MediaWork uses "subclass-table" (so is persisted into NEWSPAPER, or MAGAZINE tables)
Our schema is currently generated with a single FK in the READER table, across to the first of the NEWSPAPER/MAGAZINE tables, and results in exceptions on persist/retrieve.

Sort Order: Ascending order - Click to sort in descending order
Andy Jefferson added a comment - 06/Apr/15 11:06 AM
Schema generation works fine as far as it puts a FK column (without the actual FK) on the READER table. Current GitHub master code (4.1.0.m4) allows for persistence, and basic retrieval of the provided example.

What it doesn't do is allow querying of something like

SELECT FROM Reader WHERE = 'Some Name'

since this would need to join to the related table, yet there isn't a single table. So what SQL would we expect in that situation? Subquery?

Andy Jefferson added a comment - 06/Apr/15 01:31 PM
GitHub master now passes the specified test. The JDOQL was changed to

SELECT FROM Reader WHERE ((org.jpox.samples.one_one.unidir_2.Magazine)media).name == 'value'

hence giving JDOQL a clue which subtype to look for.

Any requirement for the original query can be raised as a separate issue with a proposal for what the SQL should look like ...