openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Curtis <curti...@gmail.com>
Subject Re: Dynamic DataSource Selection with JPA
Date Wed, 12 Nov 2014 17:31:43 GMT
Dave -

Not sure if this will help, but you can pass in a DataSource an
EntityManager creation time[1].

[1]
http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#ref_guide_dbsetup_setDSPerEM

Thanks,
Rick

On Wed, Nov 12, 2014 at 8:46 AM, Dave Westerman <dlwester@us.ibm.com> wrote:

> 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!




-- 
*Rick Curtis*

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