openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Krzysztof <>
Subject Re: Use of AbstractLRSProxyCollection
Date Mon, 19 Sep 2011 23:08:51 GMT
I have quite similar problem and I have been inclined to create a custom

Have you managed to attach yours along with LRS annotation by any chance?

Is it possible to do this or one must create a custom ProxyManager? Or
there's other way? 

There are three implementations of LRSCollectionFieldStrategy that use
LRSCollectionProxy and its not clear how to expand on them for oneToMany
associations with custom LRSCollectionProxy.

As a side note, in the current codebase LRSCollecionProxy always generates
jdbc queries for size() calls, i.e. via PersistAll():
isEmpty()->size()->count() calls chain regardless of the LRSSize setting. 
Also, adding entities to LRS collection always generates SQL that fetches
all entities on persistAll which defies the purpose of the LRS to some

Check count() in LRSProxyCollection that will always generate the select
count(*) from colTable (unless I'm missing sth..):

 protected int count() {
        final ClassMapping[] elems = _strat.getIndependentElementMappings
        final OpenJPAStateManager sm = assertOwner();
        final JDBCStore store = getStore();
        Union union = store.getSQLFactory().newUnion
            (Math.max(1, elems.length)); Union.Selector() {
            public void select(Select sel, int idx) {
                ClassMapping elem = (elems.length == 0) ? null : elems[idx];
                    sm.getObjectId(), _strat.getFieldMapping().
                    getDefiningMapping(), store);

        try {
            return union.getCount(store);
        } catch (SQLException se) {
            throw SQLExceptions.getStore(se, store.getDBDictionary());

Should this be treated as a bug, shouldn't it?

Best regards,

View this message in context:
Sent from the OpenJPA Developers mailing list archive at

View raw message