Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Dynamic DataSource Selection with JPA

$
0
0
I am working with a group that has an application that has a very critical
need for high availability and performance. To make a long story short,
they want to use DB2 HADR for availability. But they also want to use the
DB2 HADR read-on-standby facility if the application server is co-located
with the database server, for performance reasons.

The above details aren't really important here. But what I would like to
know is if there is a way to dynamically choose which datasource the JPA
calls will be using at runtime, based on some algorithm. All update calls
to a JPA entity will always use the primary datasource. But if the entity
is only being read, then the standby datasource may be the one used if the
servers are co-located.

I'm not sure if this is even feasible with JPA, but hopefully someone here
can tell me.

Thanks!

Viewing all articles
Browse latest Browse all 5648

Trending Articles