Issue Details (XML | Word | Printable)

Key: NUCCORE-1014
Type: Improvement Improvement
Status: Open Open
Priority: Trivial Trivial
Assignee: Unassigned
Reporter: Emmanuel Poitier
Votes: 0
Watchers: 0

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

Support 1-N with subclass-table and compound identity, or trap in metadata processing

Created: 13/Mar/13 08:50 AM   Updated: 16/Mar/13 03:25 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

File Attachments: 1. File datanucleus-samples-jdo-tutorial-inheritance-3.2.tbz2 (4.37 MB)
2. File store.rdbms.trunk.diff (0.8 kB)

Environment: Datanucleus

Severity: Production

 Description  « Hide

I found a small issue with certain metadata files and throwing a java.lang.NullPointerException in where the datastoreClass variable may be null, and failing during the test datastoreClass.getIdMapping().

Please find attached to this issue a patch to apply to give the necessary information in the log and not the plain java.lang.NullPointerException.

Best regards,
Emmanuel Poitier

Sort Order: Ascending order - Click to sort in descending order
Emmanuel Poitier added a comment - 13/Mar/13 08:51 AM
Patch to apply to avoid the NullPointerException throwing when datastoreClass is null

Andy Jefferson added a comment - 13/Mar/13 08:54 AM
Why is datastoreClass null ? If its null then something has gone wrong earlier, so that is what needs addressing.

Emmanuel Poitier added a comment - 13/Mar/13 09:06 AM

this is due to incorrect use of a class used as the key of a persistent class, and without any details about where to start looking at, the user would be quite frustrated where to look at.

This issue I did see is mainly due to the metadata being incorrect.

Best regards,
Emmanuel Poitier

Andy Jefferson added a comment - 13/Mar/13 09:08 AM
So the problem is in metadata specification then (if I understand what you're saying), so a check needs to go into AbstractClassMetaData. Define an example class and its metadata (just the important parts)

Emmanuel Poitier added a comment - 16/Mar/13 02:24 PM - edited

Please find the file datanucleus-samples-jdo-tutorial-inheritance-3.2.tbz2 demonstrating the issue following the steps below:

1. cd datanucleus-samples-jdo-tutorial-inheritance-3.2
2. ant
3. ant enhance
4. ant createschema
5. Notice the NullPointerException raised at the same location indicated above

Best regards,
Emmanuel Poitier

Emmanuel Poitier added a comment - 16/Mar/13 02:25 PM
Sample to recreate the issue

Andy Jefferson added a comment - 16/Mar/13 03:25 PM
Moved to core since such metadata checks should never be in a "store" plugin. RDBMS plugin has very strict limitations on use of subclass-table, and it would never be recommended to try it with compound identity. Low priority so contribute a patch to AbstractClassMetaData to check for it and throw an InvalidMetaDataException if this is a priority to you