Hi everyone,

i have a problem using dynamic proxies in a multiuser enviroment. Assume
that client A has a unmaterialized proxy P for the persistent object
Person. The Person got deleted by client B. When client A tries to
access the proxy P a NullPointerException will be thrown. The tests
succeed with only one client and dynamic proxies and also for multiple
clients without dynamic proxies.

The behaviour is similar when a person's address has been deleted, e.g.
assume again that client A has an unmaterialized Proxy of a Person
object. Client B deletes an address object of the Person object
referenced by the unmaterialized Proxy of Client A. If client A executes
a statement like broker.delete(person) a NullPointerException will be
thrown by trying to access the unmaterialized proxy of the deleted
Address object.

The reason of this failures is obvious (the proxy tries to materialize a
non existent object) but I am not sure if OJB should handle this
situation, or if I have to manualy examine for every proxy if its real
object got deleted. Any help will be appreciated.

I am using tha PB API (rc2), per broker cache and user repository xml
file as follows:
<!-- ############################################### -->
<!-- ########## Address class dercription ########## -->
<!-- ############################################### -->
<class-descriptor class="com.roxes.store.sample.Address">
    <extent-class class-ref="com.roxes.store.sample.AddressImpl" />
</class-descriptor>

<class-descriptor class="com.roxes.store.sample.AddressImpl"
table="address" proxy="dynamic">

        <!-- ############################# -->
        <!-- ##### field descriptors ##### -->
        <!-- ############################# -->
        <field-descriptor id="1"
                name="id"
                column="ADDRESS_ID"
                jdbc-type="VARCHAR"
                autoincrement="true"
                primarykey="true"
        />

        <field-descriptor id="2"
                name="personId"
                column="PERSON_ID"
                jdbc-type="VARCHAR"
        />

        <field-descriptor id="3"
                name="streetName"
                column="STREET"
                jdbc-type="VARCHAR"
        />

        <field-descriptor id="4"
                name="city"
                column="CITY"
                jdbc-type="VARCHAR"
        />

        <field-descriptor id="5"
                name="country"
                column="COUNTRY"
                jdbc-type="VARCHAR"
        />

        <field-descriptor id="6"
                name="postcode"
                column="POSTCODE"
                jdbc-type="VARCHAR"
        />

        <field-descriptor id="7"
                name="isPrivate"
                column="PRIVATE"
                jdbc-type="BIT"
        />

        <field-descriptor id="8"
                name="email"
                column="EMAIL"
                jdbc-type="VARCHAR"
        />

        <field-descriptor id="9"
                name="telephoneNumber"
                column="TELEPHONE"
                jdbc-type="VARCHAR"
        />

        <!-- ############################################# -->
        <!-- ##### foreign key reference definitions ##### -->
        <!-- ############################################# -->
        <reference-descriptor
                name="person"
                class-ref="com.roxes.store.sample.PersonImpl"
                refesh="true"
        >
                <foreignkey field-id-ref="2"/>
        </reference-descriptor>
</class-descriptor>


<!-- ############################################## -->
<!-- ########## Person class description ########## -->
<!-- ############################################## -->
<class-descriptor class="com.roxes.store.sample.Person">
    <extent-class class-ref="com.roxes.store.sample.PersonImpl" />
</class-descriptor>

<class-descriptor class="com.roxes.store.sample.PersonImpl"
table="person" proxy="dynamic">

        <field-descriptor id="1"
                name="id"
                column="PERSON_ID"
                jdbc-type="VARCHAR"
                autoincrement="true"
                primarykey="true"
        />

        <field-descriptor id="2"
                name="forename"
                column="FORENAME"
                jdbc-type="VARCHAR"
        />

        <field-descriptor id="3"
                name="surname"
                column="SURNAME"
                jdbc-type="VARCHAR"
        />

        <field-descriptor id="4"
                name="birthday"
                column="BIRTHDAY"
                jdbc-type="DATE"
        />

        <field-descriptor id="5"
                name="email"
                column="EMAIL"
                jdbc-type="VARCHAR"
        />

        <field-descriptor id="6"
                name="mobileTelephoneNumber"
                column="MOBILE"
                jdbc-type="VARCHAR"
        />

        <collection-descriptor
                name="addresses"
                element-class-ref="com.roxes.store.sample.AddressImpl"

                auto-retrieve="true"
                auto-delete="true"
                refresh="true"
        >
                <fk-pointing-to-this-class column="PERSON_ID"/>
                <fk-pointing-to-element-class column="ADDRESS_ID"/>
        </collection-descriptor>

</class-descriptor>



This is the exception trace

java.lang.NullPointerException
        at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.delete(Unknown
Source)
        at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.deleteCollections(Unknown Source)
        at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.delete(Unknown
Source)
        at
org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.delete(Unknown Source)
        at
com.roxes.store.ojb.PBResourceManager.delete(PBResourceManager.java:171)
        at com.roxes.store.ojb.OJBStore.delete(OJBStore.java:217)
        at
com.roxes.store.sample.AddressBook.remove(AddressBook.java:172)
        at
com.roxes.store.sample.test.AddressBookTestCase.testRemove(AddressBookTestCase.java:126)
        at
com.roxes.store.sample.test.AddressBookTestCase.runTest(AddressBookTestCase.java:48)
        at junit.framework.TestCase.runBare(TestCase.java:140)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:131)
        at
junit.extensions.ActiveTestSuite$1.run(ActiveTestSuite.java:26)
rethrown as org.apache.ojb.broker.PersistenceBrokerException
        at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.deleteCollections(Unknown Source)
        at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.delete(Unknown
Source)
        at
org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.delete(Unknown Source)
        at
com.roxes.store.ojb.PBResourceManager.delete(PBResourceManager.java:171)
        at com.roxes.store.ojb.OJBStore.delete(OJBStore.java:217)
        at
com.roxes.store.sample.AddressBook.remove(AddressBook.java:172)
        at
com.roxes.store.sample.test.AddressBookTestCase.testRemove(AddressBookTestCase.java:126)
        at
com.roxes.store.sample.test.AddressBookTestCase.runTest(AddressBookTestCase.java:48)
        at junit.framework.TestCase.runBare(TestCase.java:140)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:131)
        at
junit.extensions.ActiveTestSuite$1.run(ActiveTestSuite.java:26)
Caused by: java.lang.NullPointerException
        at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.delete(Unknown
Source)
        ... 14 more



Thanks in advance,
Nikos
-- 
Nikos Vitalis <[EMAIL PROTECTED]>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to