This question, or some variant, has been asked on several occasions. If you 
have not already, I would look into their solutions. However, this seems 
like there is a flaw in the data model. Is there any particular reason why 
the data is not migrated into one database. Or that the API be split to 
follow a micro service paradigm?


On Monday, April 25, 2016 at 8:44:14 AM UTC-5, vandana gopal wrote:
>
> I am trying to use two different databases within the same resource 
> method. But it looks like the UnitOfWork automatically scopes the resource 
> method to a session of a single database. 
> Here is my code:
> @GET
> @UnitOfWork(value="db1Hibernate")
> public Response getItemDocuments() {
>    
>   Organization org = getOrg();
>   Item item = <use db1 dao here>
> }
>
> @UnitOfWork(value="db2Hibernate")
> private Organization getOrg(){
>   Organization org = <use db2 dao here>
>    return org;
> }
>
> However this does not work. The getOrg method throws an error "No session 
> currently bound to execution context".
> If I change the @UnitOfWork value to db2Hibernate on the getItemDocuments 
> method, then the getOrg method works fine, but then the Item statement 
> throws the error.
> Manually opening a session and registering it with ManagedSessionContext 
> works fine, but wanted to know if there is a way to handle two databases 
> seamlessly.
> Any help is greatly appreciated.
> Any help is greatly appreciated.
>
>

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

Reply via email to