Issue Details (XML | Word | Printable)

Key: NUCRDBMS-674
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: Vladimir Konkov
Votes: 0
Watchers: 0
Operations

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

NPE when use value-map discriminator strategy in embedded object

Created: 25/May/13 01:21 PM   Updated: 01/Jun/13 09:48 AM   Resolved: 27/May/13 08:23 AM
Component/s: ORM
Affects Version/s: 3.1.4, 3.1.5, 3.2.1, 3.2.2
Fix Version/s: 3.2.3

File Attachments: 1. File NUCRDBMS-674-TestCase.diff (6 kB)

Environment: MacOS 10.8.3, Oracle JDK 1.6_41

Severity: Development


 Description  « Hide
Example mapping:

    <package name="ru.citc.paymentprocessing.core.domain.disbursement">
        <class name="PaymentDetails" detachable="true" embedded-only="true">
            <!--TODO switch to value-map strategy when NPE will be fixed in Datanucleus-->
            <inheritance strategy="new-table">
                <discriminator strategy="value-map" column="paymentDetailsType"/>
            </inheritance>

            <field name="receiver" embedded="true" default-fetch-group="true"/>
        </class>
    </package>

    <package name="ru.citc.paymentprocessing.core.domain.disbursement">
        <class name="PersonOnlyPaymentDetails" detachable="true" embedded-only="true" persistence-capable-superclass="PaymentDetails">
            <inheritance strategy="superclass-table">
                <discriminator value="PERSON"/>
            </inheritance>
        </class>
    </package>


The bug in EmbeddedMapping.initialize, when new DiscriminatorMetaData is created the parent MetaData is not set. That is fatal for MetaDataUtils.getClassNameFromDiscriminatorValue call.
Sorry for not providing patch...

Sort Order: Ascending order - Click to sort in descending order
Vladimir Konkov added a comment - 25/May/13 04:02 PM
Test case attached. Patch created against 3.2 branch of DataNucleus test End-to-End tests. Test created in jdo.rdbms module... maybe that's wrong location for it. I've created 3 new model clasess because not found inheritance with embedded example in test.sample module.

Vladimir Konkov added a comment - 27/May/13 08:18 AM
Andy, thanx for fix in r17228! Can it be backported to 2.2.x branch?

Andy Jefferson added a comment - 27/May/13 08:23 AM
SVN trunk has this.

As all docs clearly say, nothing earlier than 3.2 is now supported. If you want it on 2.2 then you port it there and maintain it there (in your own repository)

Vladimir Konkov added a comment - 27/May/13 08:24 AM
Sorry, I mean 3.2.x .

Andy Jefferson added a comment - 27/May/13 08:28 AM
3.2.x is trunk!