It's not your fault, your code is correct - it's a bug in OJB. Better to 
say: it was forgotten to implement the getPBKey() and setPBKey methods 
in org.apache.ojb.broker.server.PersistenceBrokerClient.

I found this out about one week ago and I fixed it. I'm sorry that I 
didn't announce this earlier and publish my patch here, but I I'm under 
strong pressure to finish my works. Moreover I resigned from using the 
OJB C/S mode after I ran some tests in the C/S mode. The result was very 
disappointing. In the current C/S mode implementation OJB is horribly 
slow. An example query on a table with lots of references to other 
tables took far more than one minute!!! Additionally I couldn't run the 
junit tests successfully in C/S mode - so I gave up on the C/S mode.

I'm currently working on a distributed solution with RMI. Although RMI 
is also not a speed king the results were much better. The same query 
takes me now just 10 seconds. I just have some problems by implementing 
a remote observer to notify all clients of changes on a persistent object...

You might say now that 10 seconds is also slow but this was not only the 
time of the query. In both cases I took the time which is was printed 
out by the ant task for running my test client, so that means it 
includes invocation of the java VM, jakarta-ant and the initialization 
of my test client and initialization of OJB.

/olaf


But if you want to continue to play around with the C/S mode, you can 
use my 'guerilla patch':

1) org.apache.ojb.broker.server.PersistenceBrokerClient:
Create a private variable for the pbKey and change the methods 
getPBKey() and setPBKey():

    private PBKey pbKey;

    ...

    public PBKey getPBKey()
    {
        /*@todo implementation*/
        //throw new UnsupportedOperationException("Not implemented!!");
        return pbKey;
    }

    public void setPBKey(PBKey key)
    {
        /*@todo implementation*/
        //throw new UnsupportedOperationException("Not implemented!!");
        pbKey = key;
    }

2) org.apache.ojb.odmg.DatabaseImpl:
Change the method open(), by adding a line which sets the pbKey. 
ATTENTION: this does not work when the database is not named, ie. 
name=null, when you open the database the first time.

            if(name == null)
            {
                if(log.isDebugEnabled()) log.debug("name was null, open 
default database");
                broker = 
PersistenceBrokerFactory.defaultPersistenceBroker();
                pbKey = broker.getPBKey();
            }
            else
            {
                broker = 
PersistenceBrokerFactory.createPersistenceBroker(extractAllTokens(name));
                broker.setPBKey(extractAllTokens(name));
                pbKey = broker.getPBKey();
            }



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

Reply via email to