|
Home > Archive > Apache JDO Project > June 2005 > 4 non transactional read errors
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
4 non transactional read errors
|
|
| Michael Watzek 2005-06-27, 5:45 pm |
| Hi Craig,
there are two tests throwing a JDOUserException ("Can't read fields with
outside of transactions. You may want to set
'NontransactionalRead=true'.").
The first test ("Retrieve.runTestRetrieve") begins a transaction,
retrieves fields of a pc instance, commits, and calls a getter method on
that instance.
The second test ("HollowInstanceMaintainsPK.test") begins a transaction,
makes an object persistent, commits, and calls a getter method on that
object.
Both tests seem to assume that non-transactional read is set. Should we
change the test cases and make the pc instances transient before we call
the getter?
Furthermore, we have two errors
("org.jpox.exceptions.TransactionNotActiveException: Transaction is not
active..."). Both test cases ("IteratorHasNextFalseAfterExtentClose",
"Iterators") iterate an extent outside of a transactions. I can fix this
also.
Regards,
Michael
--
-------------------------------------------------------------------
Michael Watzek Tech@Spree Engineering GmbH
mailto:mwa.tech@spree.de Buelowstr. 66
Tel.: ++49/30/235 520 36 10783 Berlin - Germany
Fax.: ++49/30/217 520 12 http://www.spree.de/
-------------------------------------------------------------------
| |
| Craig Russell 2005-06-27, 5:45 pm |
| | |
| Michael Bouschen 2005-06-27, 5:45 pm |
| Hi Craig,
> Hi Michael,
>
> On Jun 27, 2005, at 10:03 AM, Michael Watzek wrote:
>
>
>
> From the sound of it, it is the PK that is being read. If this is the
> case, then no transaction is required. PK fields can always be read,
> even for deleted instances.
>
>
>
> No, nontransactional read is an optional feature, so we can't assume
> that it is supported. The correct fix is to start a transaction before
> reading the field, and commit the transaction after reading the field.
The first test Retrieve.runTestRetrieve tests PM's retrieve API. It
calls pm.retrieve, commits the transaction and then checks the fields of
the instance passed to pm.retrieve. If we start a transaction before
reading the field the state of the instance might be reloaded. In this
case we not actually check whether pm.retrieve loads the correct values.
The test method calls pm.retrieve for 3 instances. Two of them are made
transient before committing the transaction. Do you recall whether there
is a special reason for not making the third one transient, too? If not
I propose to make it transient and then we do not need nontransactional
read at all.
Regards Michael
>
>
>
> Yes, please fix these.
>
> Thanks,
>
> Craig
>
>
> 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!
>
>
--
Michael Bouschen Tech@Spree Engineering GmbH
mailto:mbo.tech@spree.de http://www.tech.spree.de/
Tel.:++49/30/235 520-33 Buelowstr. 66
Fax.:++49/30/2175 2012 D-10783 Berlin
| |
| Craig Russell 2005-06-27, 5:45 pm |
| |
|
|
|
|