[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipselink-users] Connecting to multiple different databases efficiently
|
Hi!
I haven't actually used EclipseLink much yet, only Hibernate. I'm
writing this mail to ask if EclipseLink supports something I need, but
which Hibernate unfortunately doesn't support.
I'm developing a servlet which needs to connect to one of many
databases, depending on the request. I'm using application-managed
entity mangers and resource-local transactions.
To make it as fast as possible, I would like to create the
EntityManagerFactory with all the common settings in init() and then
only override connection details (database URL specifically) when
creating the EntityManager in service():.
Theoretically, this should IMO be possible, since JPA supports
overriding properties both in
Persistence.createEntityManagerFactory(pu, map) and in
EntityManagerFactory.createEntityManager(map).
It seems, however, that both Hibernate and EclipseLink ignore
connection properties (hibernate.connection.* and eclipselink.jdbc.*)
when passed to EntityManagerFactory.createEntityManager(map).
I realize and accept that this might prevent caching of database
connections.
Does EclipseLink support this use case in any way?
Regards,
Jaka