Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-dev] setProperty(Object,Value) of EM API

Allowing a user to set properties that may or may not be ignored for any number of reasons or deployment targets is not very user friendly.  The property handling and processing should be better validated.  If a user calls setProperty but that property can not be applied at this point in the EM lifecycle then EclipseLink should raise an exception with instructions on how and when the property can be set.  Given UOW initialization time is container specific we should also provide a means to reset the UOW if the user chooses.
Right now our properties support seems to be a bit "undefined" so I (or anyone else who wants to create the page in the wiki) will add a feature to the 2.0 work so we can define our property processing functional requirements.
--Gordon

James Sutherland wrote:

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.

 

 

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

 

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

 

 
_______________________________________________
eclipselink-dev mailing list
eclipselink-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-dev
  

_______________________________________________ eclipselink-dev mailing list eclipselink-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/eclipselink-dev

Back to the top