On 19 Dec 2011 at 16:56, Richardson, Jason - FSA, Kansas City, MO 
wrote:

> What is the swords object store?  And how do I access it?
> 

Terribly sorry about that - I was using my 'phone and it autocorrected 
"sql" into "swords" - don't ask!


Thinking about your need to access two databases simultaneously - I 
have already implemented something that I required for another 
project that built a custom datastore that farmed off requests to one of 
two destinations based on (in my case), a single class type.

That might be the quickest solution - it would need :
*) some kind of mark-up, probably an annotation, to determine which 
store to route the request to.
*) some way of specifying the jdbc connection info for each of the SQL 
datastores

Have a look at the ObjectStore interface, and you'll see what I mean.

for example, in my case, one of the methods looks like this:

    public void resolveField(ObjectAdapter object, ObjectAssociation field) {
        if (specification.isOfType(field.getSpecification())) {
            final ObjectAdapter referencedPojo = field.get(object);
            getObjectViaRest(null, referencedPojo, false);
        } else {
            sqlOs.resolveField(object, field);
        }
    }

where "specification" is set up during "open()" and captures the 
ObjectSpecification of the one class that is maintained my "other" 
store - in this case, a REST-based service, and sqlOs the "normal" 
SqlObjectStore.

In your case, you'll want two instances of SqlObjectStore...

It might be important to not let your object graphs cross object stores - 
i.e. if Customer is in one database, and Invoice is in another, there 
might be issues if Invoice has a Customer field.. but then again, 
maybe not. It's the "ResolveImmediately" that bothers me...


Reply via email to