Hi,

I've just discovered this thread and I find myself in a somewhat similar 
situation as described by Martin, working with guice-persist. In my case I 
have a POJO holding the applications configuration which gets injected 
itself from bound constants loaded from a properties file. So (from my 
understanding) at the time of installing the guice-persist module, the POJO 
instance can't be created/injected yet as we're still in the phase of 
configuring the bindings, so I can't access the POJOs fields to load the 
properties for the guice-persist module.

I've also discovered https://github.com/sclassen/guice-jpa which looks like 
its able to solve one of my other issues but I couldn't figure out how to 
solve this runtime configuration issue with it either.

Any ideas?

Cheers,
Daniel


On Wednesday, 26 September 2012 10:11:08 UTC+2, Martin Schayna wrote:
>
> Hi,
>
> I have small API server application based on Jersey, Hibernate/JPA and 
> Guice, running in Tomcat. I want to use guice-persist extension for better 
> handling EntityManager instances and transactions. Now I'm doing the whole 
> work in each controller method, so each method creates EntityManager, 
> starts transaction, close everything etc. The guice-persist thing looks 
> pretty straightforward, but I don't know how to handle this:
>
> I have only one persistence-unit, but application caches more 
> EntityManagerFactory instances, each with its own properties. These 
> properties are loaded from configuration on runtime. I cannot configure 
> GuiceServletContextListener with module 
> JpaPersistModule("unit").properties(myProperties) because myProperties are 
> based on request parameters -- my application supports multi-tenancy and 
> tenants has data in several similar databases.
>
> How can I use guice-persist with this scenario?
>
> Thanks, 
> Martin Schayna
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to