[ 
https://issues.apache.org/jira/browse/JDO-630?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Craig Russell updated JDO-630:
------------------------------

    Attachment: jdo-630.patch

Please review this patch.

I've added a subset of the company model (just Person, Employee, 
PartTimeEmployee, and FullTimeEmployee) to define the classes as having 
LongIdentity.

The test with the 2.0.0-release RI fails with:

    [echo] Starting configuration="clr.conf" with database="derby" 
identitytype="applicationidentity" mapping="" on the Reference Implementation.
    [java] RUN GetObjectByIdExactClass.testAbstractSuperclassExact         ERROR
    [java] RUN GetObjectByIdExactClass.testAbstractSuperclassNotExact   
    [java] RUN GetObjectByIdExactClass.testConcreteSuperclassExact         
FAILURE
    [java] RUN GetObjectByIdExactClass.testConcreteSuperclassNotExact      
FAILURE
    [java] RUN GetObjectByIdExactClass.testWrongClass   
    [java] RUN GetObjectByIdExactClass.testRightClass   
    [java] Description: All pmf tests with standard mapping, no testdata.
    [java] Time: 003
    [java] There was 1 error:
    [java] 1) 
testAbstractSuperclassExact(org.apache.jdo.tck.api.persistencemanager.getobject.GetObjectByIdExactClass)java.lang.NullPointerException
    [java]      at 
org.datanucleus.state.JDOStateManagerImpl.cache(JDOStateManagerImpl.java:659)
    [java]      at 
org.datanucleus.ObjectManagerImpl.putObjectIntoLevel2CacheInternal(ObjectManagerImpl.java:3916)
    [java]      at 
org.datanucleus.ObjectManagerImpl.putObjectIntoLevel2Cache(ObjectManagerImpl.java:3893)
    [java]      at 
org.datanucleus.ObjectManagerImpl.findObject(ObjectManagerImpl.java:2821)
    [java]      at 
org.datanucleus.jdo.JDOPersistenceManager.getObjectById(JDOPersistenceManager.java:1640)
    [java]      at 
org.apache.jdo.tck.api.persistencemanager.getobject.GetObjectByIdExactClass.testAbstractSuperclassExact(GetObjectByIdExactClass.java:109)
    [java]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [java]      at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    [java]      at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    [java]      at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:272)
    [java]      at 
org.apache.jdo.tck.util.BatchTestRunner.doRun(BatchTestRunner.java:108)
    [java]      at 
org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:148)
    [java]      at 
org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:123)
    [java] There were 2 failures:
    [java] 1) 
testConcreteSuperclassExact(org.apache.jdo.tck.api.persistencemanager.getobject.GetObjectByIdExactClass)junit.framework.AssertionFailedError:
 
    [java] Assertion A12.5.6-??? (GetObjectById) failed: getObjectById returned 
wrong type org.apache.jdo.tck.pc.singlefieldidentity.Person
    [java] Assertion A12.5.6-??? (GetObjectById) failed: getObjectById exact 
for concrete superclass must fail.
    [java] 
    [java]      at org.apache.jdo.tck.JDO_Test.failOnError(JDO_Test.java:1172)
    [java]      at 
org.apache.jdo.tck.api.persistencemanager.getobject.GetObjectByIdExactClass.testConcreteSuperclassExact(GetObjectByIdExactClass.java:169)
    [java]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [java]      at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    [java]      at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    [java]      at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:272)
    [java]      at 
org.apache.jdo.tck.util.BatchTestRunner.doRun(BatchTestRunner.java:108)
    [java]      at 
org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:148)
    [java]      at 
org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:123)
    [java] 2) 
testConcreteSuperclassNotExact(org.apache.jdo.tck.api.persistencemanager.getobject.GetObjectByIdExactClass)junit.framework.AssertionFailedError:
 
    [java] Assertion A12.5.6-??? (GetObjectById) failed: getObjectById returned 
wrong type org.apache.jdo.tck.pc.singlefieldidentity.Person
    [java] 
    [java]      at org.apache.jdo.tck.JDO_Test.failOnError(JDO_Test.java:1172)
    [java]      at 
org.apache.jdo.tck.api.persistencemanager.getobject.GetObjectByIdExactClass.testConcreteSuperclassNotExact(GetObjectByIdExactClass.java:194)
    [java]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [java]      at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    [java]      at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    [java]      at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:272)
    [java]      at 
org.apache.jdo.tck.util.BatchTestRunner.doRun(BatchTestRunner.java:108)
    [java]      at 
org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:148)
    [java]      at 
org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:123)
    [java] FAILURES!!!
    [java] Error summary:
    [java] 001 error:  java.lang.NullPointerException
    [java] derby-app-clr-junit.txt:
    [java]     ** Tests run: 006, Time: 003 seconds. Failures: 2, Errors: 1
    [java] Excluded tests: [org.apache.jdo.tck.enhancement.FieldAccessModified, 
org.apache.jdo.tck.enhancement.ImplementsPersistenceCapable]
    [java] [ERROR] Java Result: 1
    [echo] Finished configuration="clr.conf" with database="derby" 
identitytype="applicationidentity" mapping="" on the Reference Implementation.


> Support specification of exact class in SingleFieldIdentity
> -----------------------------------------------------------
>
>                 Key: JDO-630
>                 URL: https://issues.apache.org/jira/browse/JDO-630
>             Project: JDO
>          Issue Type: Improvement
>          Components: specification, tck2
>            Reporter: Andy Jefferson
>            Assignee: Craig Russell
>             Fix For: JDO 2 maintenance release 3
>
>         Attachments: jdo-630.patch
>
>
> When calling PersistenceManager.getObjectById() with a SingleFieldIdentity, 
> there seems to be no way of avoiding the following 
> (if the implementation decides to do so):
> "It is an implementation decision whether to access the data store, if 
> required to determine the exact class. This will be the case of  inheritance, 
> where multiple <code>PersistenceCapable</code> classes share the same 
> ObjectId class."
> Now when I know for sure that the targetClassName of the given 
> SingleFieldIdentity already denotes the correct class for the given id,  how 
> can I avoid that additional roundtrip to the database for finding the exact 
> class?
> It would be useful to have a way of specifying a SingleFieldIdentity to be 
> for the exact class specified. This could be done by addition of methods
> void setExact(boolean flag);
> boolean getExact();
> to SingleFieldIdentity

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to