openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dick <michael.d.d...@gmail.com>
Subject Re: Help with Collection Proxies
Date Wed, 16 Mar 2011 14:06:30 GMT
On Tue, Mar 15, 2011 at 10:15 PM, Todd Nine <todd@spidertracks.com> wrote:

> Hi guys,
>  I have a few questions regarding large sets and ordering and could use
> some help from the developers.
>
>
> First, everything in Cassandra needs to be write ordering.  I must have
> the properties of the values that have changed on write in order to
> correctly build our indexes to support the "OrderBy" annotation
> properly.   If I were to define an annotation such as this
>
> @OrderBy("following.firstName, following.lastName")


I'm not entirely sure where you were going with this, but here goes.

The OrderBy annotation is used to order the elements of a collection when an
entity is loaded from the database. If you're using the OpenJPA internals to
get a list of changed attributes they may also follow that order, but I
think that would be a 'happy coincidence' and not something you can rely
upon.

I haven't looked into this in any depth (at least not recently), but I think
you'd want to start by looking at the
OperationOrderUpdateManager<http://openjpa.apache.org/builds/latest/docs/javadoc/org/apache/openjpa/jdbc/kernel/OperationOrderUpdateManager.html>and
ConstraintUpdateManager<http://openjpa.apache.org/builds/latest/docs/javadoc/org/apache/openjpa/jdbc/kernel/ConstraintUpdateManager.html>.



> Are there are core API's that exist I can use to pass an object and
> retrieve the value?  I've had a look at the MetaDataRepository, but I'm
> unsure how to go about getting the values loaded when the case is a
> nested object such as above.
>

The MetaDataRepository contains data about the entity (how it's fields map
to the database, column names, etc.). To access the values of a particular
entity instance you'll probably want to start with its
StateManager<http://openjpa.apache.org/builds/latest/docs/javadoc/index.html>.


Second, we're doing very little when we create our own store
> configuration.
>
>
> https://github.com/riptano/hector-jpa/blob/master/src/main/java/com/datastax/hectorjpa/store/CassandraStoreConfiguration.java
>
> By default, will all collections/maps get wrapped in a Proxy instance
> once it's been attached to the EM?  We have the potential for huge
> collections, so they must be proxies after the initial save and we need
> to be sure that we wrap the collection in a proxy.  Any guidance would
> be greatly appreciated.


All second class objects (collections, Date/Timestamps, etc.) are wrappered
with Proxy classes for better state tracking. The proxies are inserted at
persist time in OpenJPA 2.0 (it's slightly different in earlier versions).

Would you need your own proxy? Or are you just interested in ensuring we
insert an OpenJPA proxy?

Hope this helps,

-mike

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message