From what I can
understand the setProperty() method provides a way to allow the JTA / EJB
usage to set runtime properties. Before this was not
possible, as the EntityManager is not created by the user but by the
container, so properties that could be set in application managed mode,
could not be set in container managed mode. You should be
able to set any EntityManager property using this, you just must ensure this
is the first thing done to the EntityManager. The
proxy-type, user, password, etc are important to support, as this is how
proxy connections must be used if using
EJB.
<!--[if
!supportEmptyParas]--> <!--[endif]-->
<!--[if
!supportEmptyParas]--> <!--[endif]-->
-----Original
Message-----
From: Gordon
Yorke
Sent: Monday, March
16, 2009 3:54 PM
To: Dev
mailing list for Eclipse Persistence Services
Subject: Re: [eclipselink-dev]
setProperty(Object,Value) of EM API
<!--[if
!supportEmptyParas]--> <!--[endif]-->
Only PERSISTENCE_CONTEXT_CLOSE_ON_COMMIT,
PERSISTENCE_CONTEXT_PERSIST_ON_COMMIT, PERSISTENCE_CONTEXT_FLUSH_MODE,
VALIDATE_EXISTENCE and FLUSH_CLEAR_CACHE are allowed once an EntityManager
has been created.
The message of the illegal argument should state
that the property is not valid at this point in the lifecycle of the
EntityManager.
--Gordon
Darani Yallapragada wrote:
Hello All:
I am trying to implement
'setProperty(Object,Value)' method of EM API. I have few questions about the
implementation :
We have following properties that are
supported properties in EM:
JOIN_EXISTING_TRANSACTION
PERSISTENCE_CONTEXT_REFERENCE_MODE
PERSISTENCE_CONTEXT_CLOSE_ON_COMMIT
PERSISTENCE_CONTEXT_PERSIST_ON_COMMIT
PERSISTENCE_CONTEXT_FLUSH_MODE
ORACLE_PROXY_TYPE
EXCLUSIVE_CONNECTION_MODE
EXCLUSIVE_CONNECTION_IS_LAZY
JTA_DATASOURCE
NON_JTA_DATASOURCE
JDBC_DRIVER
JDBC_URL
JDBC_USER
JDBC_PASSWORD
CONNECTION_POLICY
VALIDATE_EXISTENCE
FLUSH_CLEAR_CACHE
In
the above, 'JDBC_DRIVER', 'JDBC_USER', 'JDBC_URL', 'JDBC_PASSWORD' cannot be
changed once the connection is already made.
According to the Spec,
if the 'value' is not valid , it has to throw 'IllegalArgumentException.' I
understand that we got to first check for
properties that should
not be changed using 'setProperty() ? What are those properties that should
not be changed using 'setProperty()'
And also, does changing any of
the properties throw only 'IllegalArgumentException' ?
Thank
You
Regards
Darani
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!--[if !supportEmptyParas]--> <!--[endif]-->
_______________________________________________
eclipselink-dev mailing list
eclipselink-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-dev