Need Custom Transaction Method Interception (case with multiple databases configured at RT)

3 views
Skip to first unread message

dilit

unread,
Mar 1, 2010, 10:07:01 PM3/1/10
to warp-core
Hello,

I need some help in applying Warp to my case:
We have dozens of databases: 1 for each sub-domain.
Each database is invoked when a certain id parameter is passed in an
http request.
So, if id=1, update database_1, id=2 update databse_2, so on.

We are using JPA EntityManagerFactory configured on the app startup
and stored in the app memory.
persistence.xml is only used as a template.

Also, we are using Guice Method Interception Injection now. The
interceptor has access to the id, based on which
it creates ThreadLocal JPA EntityManager for the db. We begin and end
transaction around the method call.
Works fine; however, I'd like to use Warp to be able to annotate
classes and use many other neat warp features.

The question is: Is there way to bind the correct EntityManager to the
transaction based on the id.
Would be nice to be able to customize Transactional method interceptor
ourselves to obtain that db id based on different scenarios.

Please help!
Thank you in advance.

Dhanji R. Prasanna

unread,
Aug 9, 2010, 8:01:56 AM8/9/10
to warp...@googlegroups.com
Yes, warp persist 2 (if you build from trunk) will allow this. You have to create an annotation per entity manager and apply these in each @Transactional method. Robbie can explain more.

One caveat, we are shortly going to discontinue warp persist development in favor of guice-persist, which will have a somewhat different (though equally capable) API.

Dhanji.


--
You received this message because you are subscribed to the Google Groups "warp-core" group.
To post to this group, send email to warp...@googlegroups.com.
To unsubscribe from this group, send email to warp-core+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/warp-core?hl=en.


Reply all
Reply to author
Forward
0 new messages