They are
many issues with getting our exclusive connection and proxy connections working
with JPA, it simply is not supported right now.
I would
log an enhancement request so that we can design, implement and test this
feature correctly.
As a
workaround you could acquire the proxy client session from the ServerSession on
your own, and manually wrap it with a JPA EntityManagerImpl. You will also need to ensure it is
released, as closing the EntityManager will not release it. There will be additional issues in
integrating with JTA.
Also see
the Oracle bugs, 6470245, 5661313.
-----Original
Message-----
From: eclipselink-dev-bounces@xxxxxxxxxxx
[mailto:eclipselink-dev-bounces@xxxxxxxxxxx]On
Behalf Of Doug Clarke
Sent: Wednesday, February 20, 2008
8:38 AM
To: Eclipselink-Dev (E-mail)
Subject: [eclipselink-dev]
EntityManager usage of ClientSession
Developers,
On the
TopLink forum
there is a customer trying to use proxy authentication. Our documentation
and a similar thread on the JDeveloper
forum show the usage of proxy authentication using a SessionEventListener
and a custom call to Server.acquireClientSession(db-login). Using this within
JPA is proving challenging. The SessionEventListener can be easily introduced
using a persistence unit property but addressing the proxy credentials is more
challenging:
Login login = (Login)serverSession.getLogin().clone();
login.setProperty("proxytype", Integer.toString(OracleConnection.PROXYTYPE_USER_NAME));
login.setProperty(OracleConnection.PROXY_USER_NAME, "hr");
ConnectionPolicy connectionPolicy = new ConnectionPolicy(login);
// for vpd support connectionPolicy.setShouldUseExclusiveConnection(true);
clientSession = serverSession.acquireClientSession(connectionPolicy);
I took
a quick look through our implementation of EntityManager and we have one case
where we acquire a client session in the process of acquiring a UnitOfWork but
in most cases we simply acquire the UnitOfWork from the server session. I know
this internally results in a client session but it does feel weird. I would
have expected us to acquire a client session and hold it in the EntityManager
(possibly during construction) and then acquire repeatable-read UnitOfWork or
non-synchonized UnitOfWork as needed form the client session. This would allow
the isolated client session, when used, to have a life-cycle equivalent to that
of the EntityManager.
I guess
I have a few questions:
1.
Should our EntityManagerImpl wrap a client-session instead of a server session
to better handle the isolated client session's cache lifecycle matching that of
the EntityManager? If we need a server session we can always get it through
getParent()
2. How
can we address proxy authentication through JPA? We need to change how we
create the client session within the EntityManagerImpl and thus the lifecycle
of the client session is important to this discussion. See: https://bugs.eclipse.org/bugs/show_bug.cgi?id=219434
3. Does
anyone have an idea of how I could work-around our current implementation
limitations to make proxy authentication work through our current JPA
implementation in EclipseLink?
Cheers,
Doug
![Oracle Email Signature Logo]()
Doug Clarke
Director of Product Management, Oracle TopLink
Oracle Server Technologies
45 O'Connor, Suite 4000 | Ottawa, ON K1P
1A4 Canada
+1 613 288 4617