Hello,
After working with OJB for the last four months, I am still experiencing a
problem with prefetched one-to-one relationships in RC4. Although the JUnit
test works fine, my development does not correctly retrieve prefetched
relationships using an in-clause limit.

After executing the first 'SELECT ... WHERE id in (* in-clause limit)', all
further related objects are fetched 'one per sql statement'.  When all have
been retrieved in this manner, the correct behaviour is resumed, resulting
in the related objects being fetched twice from the db.

The in-clause limit is set to 200, but the problem persists no matter what
it's set to.

I've worked round the problem now with the following 'kludge' in
o.a.ojb.broker.RelationshipPrefetcherImpl;

public void prefetchRelationship(Collection owners)
        {
                Query queries[];
                Collection children = new Vector();
                //Collection children;

                queries = buildPrefetchQueries(owners, IN_LIMIT);

                for (int i = 0; i < queries.length; i++)
                {
        
children.add(getBroker().getCollectionByQuery(queries[i]));
                        //children =
getBroker().getCollectionByQuery(queries[i]));
                        //associateBatched(owners, children);
                }

                for (Iterator i = children.iterator(); i.hasNext(); )
                {
                        associateBatched(owners, (Collection) i.next());
                }

        }

but any help on a proper solution would be most welcome.

Here are entries from my OJB.properties file:

PersistenceBrokerClass=org.apache.ojb.broker.core.PersistenceBrokerImpl
maxActive=100
maxIdle=-1
maxWait=2000
timeBetweenEvictionRunsMillis=-1
minEvictableIdleTimeMillis=1000000
whenExhaustedAction=0
ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryPo
oledImpl
ConnectionManagerClass=org.apache.ojb.broker.accesslayer.ConnectionManagerIm
pl
SqlGeneratorClass=org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultI
mpl
StatementManagerClass=org.apache.ojb.broker.accesslayer.StatementManager
ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCachePerBrokerImpl
LockManagerClass=org.apache.ojb.odmg.locking.LockManagerDefaultImpl
LockMapClass=org.apache.ojb.odmg.locking.InMemoryLockMapImpl
LockTimeout=60000
ImplicitLocking=false
LockAssociations=WRITE
OqlCollectionClass=org.apache.ojb.odmg.collections.DListImpl
SqlInLimit=200
PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFi
eldPropertyImpl
OJBTxManagerClass=org.apache.ojb.odmg.LocalTxManager


The contents of this email are confidential to the intended recipient at the email 
address to which it has been addressed.  It may not be disclosed to or used by anyone 
other than this addressee, nor may it be copied in any way. If received in error, 
please contact DLA, a UK law firm, (http://www.dla.com/) on +44 (0) 8700 111111 
quoting the name of the sender and the addressee and then delete it from your system.
 
Please note that neither DLA nor the sender accepts any responsibility for viruses and 
it is your responsibility to scan the email and attachments (if any).  No contracts 
may be concluded on behalf of DLA by means of email communications.

A list of the names of the partners of DLA (who are either solicitors or registered 
foreign lawyers) and their qualifications is available for inspection at 3 Noble 
Street, London, EC2V 7EE, UK.

Regulated by the Law Society.



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

Reply via email to