openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jcarreira <>
Subject Re: How to wire up a StoreManager
Date Wed, 12 Mar 2008 06:05:35 GMT

Okay, but that's just moved the problem one level higher. At some point I'd
like to be able to have Spring build my instance and be able to pass it in
to OpenJPA to use, whether it be a BrokerFactory or the StoreManager itself. 

Does anyone else wire OpenJPA up with Spring and pass in anything like the
DataSource to be used by OpenJPA? I want to be able to use the same objects
I'm using in my Spring configuration inside OpenJPA. Outside of a Servlet
context, I don't know how to look up the ApplicationContext to directly look
up the beans.

Pinaki Poddar wrote:
> Hi,
>   You can plug-in your store manager by the following:
>    1. Extend AbstractBrokerFactory by overwriting the method  
>               protected abstract StoreManager newStoreManager();
>       Let us call this extended BrokerFactory com.gigaspaces.BrokerFactory
>    2. Let this method return an instance of your specialized StoreManager
>        For example, here is the implementation of JDBCBrokerFactory:
>        protected StoreManager newStoreManager() {
>           return new JDBCStoreManager();
>        }
>    3. Then at runtime specify 
>         <property name="openjpa.BrokerFactory"
> value="com.gigaspaces.BrokerFactory"/>
> jcarreira wrote:
>> I'm trying to implement a StoreManager that stores into and retrieves  
>> from GigaSpaces. What I need, though, is to be able to dependency- 
>> inject the StoreManager instance with its dependencies (for example  
>> the GigaSpace instance). As far as I can tell, OpenJPA uses the  
>> constructor via reflection to create the instance of the configured  
>> class for the StoreManager. This gives me no opportunity to wire it  
>> up with the stuff it needs to do its work, unfortunately.
>> Any suggestions?
>> Thanks,
>> Jason Carreira

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

View raw message