Hi Jesse,
Comments inline.
Cheers,
David
Jesse Benson wrote:
> I am a bit confused between the wording in the OpenJPA user guide and the
> results I obtain when trying to use LRS proxies.
>
> I have a collection, and I am trying to see if I can set different
> properties on it. The first being openjpa.FetchBatchSize=5 (set in the PU).
>
> When I attempt this with the following code I get 20 as an output.
>
> // Persist 20 EntityB entities.
> // Put them in the collection EntityB_LRS which is annotated LRS in EntityA.
> // Persist EntityA
> Query q = em.createQuery("select a from EntityA a");
> List<EntityA> results = (List<EntityA>) queryA.getResultList();
> Collection<EntityB> lrs = results.get(0).getEntityB_LRS();
> System.out.println(lrs.size());
>
> Shouldn't the size of the collection be 5? I thought 5 more are added to
> the lrs.iterator() after 5 next() calls?
You'll want to keep reading the manual :) . See the section 4.9 on
openjpa.jdbc.LRSSize, for the default behavior and configuration.
>
> I have similar questions for openjpa.jdbc.FetchDirection=reverse. When I
> get my lrs.iterator() it still has results in the forward direction. I am
> using a Derby driver, which I believe should support this JDBC 2.0
> functionality.
>
> How can I verify that the properties pertaining to OpenJPA's Large Result
> Sets are being honored? Are they hints for how OpenJPA should internally
> use it's result sets, or are these properties something the end user (like
> me) sees? If so, how?
They are hints for sure. OpenJPA knows something about the database
driver, and it knows something about the database, and the database
decides what it will and won't do.
To monitor the behavior, you can turn on SQL tracing to see what
statements are going to the database driver. In some cases, if the
driver you are using is more advanced than the driver that the current
DB dictionary for that driver knows about, you may have to fiddle with
setting various DB dictionary properties.
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries and affiliated
entities, that may be confidential, proprietary, copyrighted and/or legally
privileged, and is intended solely for the use of the individual or entity
named in this message. If you are not the intended recipient, and have received
this message in error, please immediately return this by email and then delete
it.