db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig Russell <Craig.Russ...@Sun.COM>
Subject Re: jpox cannot find sequence
Date Fri, 16 Sep 2005 04:20:13 GMT
Hi Erik, Andy, David,

Can you help us define a table-based incrementing sequence that can  
be used with the TCK? We (TCK team) will write a factory sequence  
class but as you know, the specification is short on how to define it.

Thanks,

Craig

On Sep 15, 2005, at 7:23 PM, karan malhi wrote:

> Thanks Craig,
>
>
> But since right now
>
> Craig Russell wrote:
>
>
>> Hi Karan,
>>
>> You might not have noticed my question earlier today regarding  
>> Derby and sequences, and the reply.
>>
>> Derby does not support sequences. So the only sequence that you  
>> will be able to use is a hand-written sequence or replace Derby by  
>> another database, e.g. SQLServer.
>>
>>
> I read your question and also Eriks response on it.Here is what i  
> read on the jpox website:
>
> "JPOX internally provides 2 forms of sequences. When the underlying  
> datastore supports native sequences, then these can be leveraged  
> through this interface. Alternatively, where the underlying  
> datastore doesn't support native sequences, then a table-based  
> incrementing sequence can be used."
>
> Looking at the above, i should still be able to get a sequence from  
> jpox. In my orm file i have ommitted the "datastore-sequence"  
> attribute from the "<sequence>" element to avoid usage of native db  
> sequence.
>
>
>> I think the expert group has some work to do before sequences are  
>> specified well enough to be tested. But we can still flesh out the  
>> test strategy even though we can't test them.
>>
>
>
>> For example, we will want to test the behavior of nontransactional  
>> and transactional sequences. We will need two threads to test  
>> transactional sequences. Each thread will ask for the next object  
>> from the same sequence, and we should make sure that these threads  
>> are serialized.
>>
>> There is not much if any testable behavior for noncontiguous  
>> sequences, except to get some number of next object and make sure  
>> that there are no duplicates. For contiguous sequences, make sure  
>> that the numbers of next objects are continuously increasing. Mix  
>> the next and nextValue methods and make sure that the numbers  
>> continuously increase.
>>
>> For nontransactional sequences, start multiple threads and make  
>> sure that they don't interfere with each other (using a barrier  
>> might work here). Nontransactional sequences should not block, but  
>> only serialize through the "increment" part of the code.
>>
>
>
>
>>
>> Craig
>>
>> On Sep 15, 2005, at 6:58 PM, karan malhi wrote:
>>
>>
>>> Hi ,
>>>
>>> I am trying to call pm.getSequence 
>>> ("org.apache.jdo.tck.pc.company.TestSequence") and i get a  
>>> JDOUserException that jpox is unable to find the sequence.
>>> Has anybody successfully obtained a sequence with jpox before?
>>> Can anybody guide me as to what am i missing in writing this test  
>>> case. If you dont find anything wrong with it, then should i  
>>> assume that this test fails and jpox does not support sequence .
>>> Has anybody tried any of the tests with mysql (we will have to  
>>> run against some db to test native datastore sequence since derby  
>>> doesnt support them)
>>>
>>> HERE IS MY .CONF FILE
>>>
>>> jdo.tck.description = Run one test for debugging
>>> jdo.tck.testdata =
>>> jdo.tck.standarddata =
>>> jdo.tck.mapping = 0
>>> jdo.tck.classes = org.apache.jdo.tck.api.persistencemanager.Test
>>>
>>> HERE IS PART OF MY package-derby.orm FILE
>>>
>>> <orm>
>>>    <package name="org.apache.jdo.tck.pc.company">
>>>     <sequence name="TestSequence"  strategy="contiguous"/>
>>>        <class name="Company" table="companies">
>>>
>>> TEST.JAVA (I am just trying to get a sequence)
>>>
>>>    public void test() {
>>>        pm = getPM();
>>>        Transaction tx = pm.currentTransaction();
>>>        tx.begin();
>>>        try{
>>>        Sequence seq = pm.getSequence 
>>> ("org.apache.jdo.tck.pc.company.TestSequence");
>>>        }catch(JDOUserException e){
>>>                      fail(ASSERTION_FAILED,
>>>            "Could not get sequence "+e.getMessage().toUpperCase());
>>>                  }
>>>
>>>
>>>        tx.commit();
>>>        pm.close();
>>>        pm = null;
>>>        }
>>>
>>> MAVEN COMMAND
>>>
>>> maven -bo -Djdo.tck.cfglist=aaa.conf - 
>>> Djdo.tck.identitytypes=applicationidentity runtck.jdori
>>>
>>>
>>> ERROR
>>>
>>> doRuntck.jdori:
>>>    [java] RUN Test.test        21:43:10,140 (main) DEBUG  
>>> [JPOX.RDBMS.SCHEMA] - Database adapter allows schemas to be used  
>>> in table definitions
>>>    [java] 21:43:10,140 (main) INFO  [JPOX.RDBMS] - RDBMS Adapter  
>>> initialised : CloudscapeAdapter : Apache Derby version=10.1.1.0,  
>>> major=10, minor=1, revision=1
>>>    [java] Identifier Names : UPPERCASE
>>>    [java] Driver name=Apache Derby Embedded JDBC Driver,  
>>> version=10.1.1.0, major=10, minor=1
>>>    [java] Identifier Max Lengths : Table=128  Column=30   
>>> Constraint=18  Index=18  Delimeters="
>>>    [java] Identifier Support in DDL : catalog=false  schema=true
>>>    [java] 21:43:10,140 (main) INFO  [JPOX.RDBMS.SCHEMA] -  
>>> Initialising Catalog "", Schema "TCKUSER" using "None" auto-start  
>>> option
>>>    [java] 21:43:10,156 (main) INFO  [JPOX.RDBMS.SCHEMA] - Catalog  
>>> "", Schema "TCKUSER" initialised - managing 0 classes
>>>    [java]    FAILURE
>>>    [java] Description: Run one test for debugging
>>>    [java] Time: 002
>>>    [java] There was 1 failure:
>>>    [java] 1) test(org.apache.jdo.tck.api.persistencemanager.Test) 
>>> junit.framework.AssertionFailedError: Assertion A12.14-1 (Test)  
>>> failed:
>>>    [java] Could not get sequence THE REQUESTED SEQUENCE  
>>> "ORG.APACHE.JDO.TCK.PC.COMPANY.TESTSEQUENCE" COULD NOT BE FOUND.  
>>> PLEASE MAKE SURE THAT IT IS SPECIFIED IN A VALID META-DATA FILE.
>>>    [java]      at org.apache.jdo.tck.JDO_Test.fail(JDO_Test.java: 
>>> 546)
>>>    [java]      at  
>>> org.apache.jdo.tck.api.persistencemanager.Test.test(Test.java:69)
>>>    [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:204)
>>>    [java]      at org.apache.jdo.tck.util.BatchTestRunner.start 
>>> (BatchTestRunner.java:115)
>>>    [java]      at org.apache.jdo.tck.util.BatchTestRunner.main 
>>> (BatchTestRunner.java:93)
>>>    [java] FAILURES!!!
>>>    [java] derby-app-aaa-junit.txt:
>>>    [java]     ** Tests run: 001, Time: 002 seconds. Failures: 1,  
>>> Errors: 0
>>>    [java] Excluded tests:  
>>> [org.apache.jdo.tck.enhancement.FieldAccessModified,  
>>> org.apache.jdo.tck.enhancement.ImplementsPersistenceCapable]
>>>    [java] [ERROR] Java Result: 1
>>>    [echo] Finished run with database="derby"  
>>> identitytype="applicationidentity" mapping="".
>>>
>>>
>>> -- 
>>> Karan Singh
>>>
>>>
>>>
>>
>> Craig Russell
>>
>> Architect, Sun Java Enterprise System http://java.sun.com/products/ 
>> jdo
>>
>> 408 276-5638 mailto:Craig.Russell@sun.com
>>
>> P.S. A good JDO? O, Gasp!
>>
>>
>>
>
> -- 
> Karan Singh
>
>

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Mime
View raw message