openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Westerman <>
Subject Dynamic DataSource Selection with JPA
Date Wed, 12 Nov 2014 14:46:24 GMT
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. 

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message