Package org.eclipse.persistence.sessions
Class DatasourceLogin
java.lang.Object
org.eclipse.persistence.sessions.DatasourceLogin
- All Implemented Interfaces:
- Serializable,- Cloneable,- CoreLogin<org.eclipse.persistence.internal.databaseaccess.Platform>,- Login
- Direct Known Subclasses:
- DatabaseLogin,- EISLogin,- XMLLogin
Purpose: Hold the configuration information necessary to connect to a datasource.
Description: This is an abstract class that defines the common datasource independent connection configuration. It is extended to support specific datasources such as JDBC, JCA, XML, etc.
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected intBy default concurrency is optimized and the cache is not locked during reads or writes, This allows for concurrent reading and writing and should never cause any problems.static final intReads and unit of work merges can occur concurrently.protected ConnectorProvide a little flexibility for connecting to a databaseprotected org.eclipse.persistence.internal.databaseaccess.PlatformImplementation of platform-specific behaviors.protected PropertiesConnection properties (e.g.static final intReads and unit of work merges will be serialized.static final intReads can occur concurrently but unit of work merges will be serialized.static final intWrites to the cache (merge, object build/refresh will be synchronized as will cache access (cloning) based on when access is required.static final intWrites to the cache (merge, object build/refresh will be synchronized as will cache access (cloning) based on database transaction.protected booleanTrue if we use an external connection pool such as WebLogic's JTS driverprotected booleanTrue if we should use some external transaction service such as JTS.static String
- 
Constructor SummaryConstructorsConstructorDescriptionPUBLIC: Create a new login.DatasourceLogin(org.eclipse.persistence.internal.databaseaccess.Platform databasePlatform) ADVANCED: Create a new login for the given platform.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddSequence(Sequence sequence) Add sequence corresponding to the name Don't use if the session is connected.clone()INTERNAL: Clone the login.connectToDatasource(org.eclipse.persistence.internal.databaseaccess.Accessor accessor, Session session) INTERNAL: Connect to the datasource, and return the driver level connection object.voidPUBLIC: Do not use external connection pooling.voidPUBLIC: Let EclipseLink control transactions instead of some external transaction service such as JTS.intADVANCED: By default concurrency is optimized and the cache is not locked more than required during reads or writes, This allows for virtual concurrent reading and writing and should never cause any problems.ADVANCED: Return the connector that will instantiate the connection.org.eclipse.persistence.internal.databaseaccess.PlatformPUBLIC: Return the datasource platform specific information.Get default sequenceINTERNAL: Used only for writing the login into XML or Java.Return the password.INTERNAL: Return the database platform specific information.INTERNAL: Return the name of the database platform class.INTERNAL: The properties are additional, driver-specific, connection information to be passed to the driver.getProperty(String name) PUBLIC: The properties are additional, driver-specific, connection information to be passed to the driver.protected org.eclipse.persistence.internal.security.SecurableObjectHolderINTERNAL: Return the encryption securable holder.getSequence(String seqName) Get sequence corresponding to the nameReturns a map of sequence names to Sequences (may be null).INTERNAL: Used only for writing the login into XML or Java.PUBLIC: Return the qualifier for the all of the tables referenced by EclipseLink.PUBLIC: The user name is the database login name.static StringPUBLIC: Return the EclipseLink version.booleanPUBLIC: This value defaults to false when not on a DatabaseLogin as the functionality has not been implemented for other datasource type.voidRemove all sequences but the default one.voidremoveProperty(String propertyName) PUBLIC: Some drivers don't like the "user" and "password" properties.removeSequence(String seqName) Remove sequence corresponding to name.voidsetCacheTransactionIsolation(int cacheTransactionIsolation) ADVANCED: By default concurrency is optimized and the cache is not locked more than required during reads or writes, This allows for virtual concurrent reading and writing and should never cause any problems.voidsetConnector(Connector connector) PUBLIC: Set the connector that will instantiate the connection.voidsetDatasourcePlatform(org.eclipse.persistence.internal.databaseaccess.Platform platform) PUBLIC: Set the database platform specific information.voidsetDefaultNullValue(Class type, Object value) PUBLIC: The default value to substitute for database NULLs can be configured on a per-class basis.voidsetDefaultSequence(Sequence sequence) Set default sequencevoidsetEncryptedPassword(String password) Set the encrypted password.voidsetEncryptionClassName(String encryptionClassName) Sets the encryption class namevoidsetPassword(String password) Set the password.voidsetPlatform(org.eclipse.persistence.internal.databaseaccess.Platform platform) INTERNAL: Set the database platform specific information.voidsetPlatformClassName(String platformClassName) INTERNAL: Set the name of the Platform to be used.voidsetPlatformClassName(String platformClassName, ClassLoader loader) INTERNAL: Set the name of the Platform to be created using the passed in class loader.voidsetProperties(Properties properties) PUBLIC: The properties are additional, driver-specific, connection information to be passed to the JDBC driver.voidsetProperty(String propertyName, Object propertyValue) PUBLIC: Some JDBC drivers require additional, driver-specific, properties.voidsetSequences(Map sequences) INTERNAL: Used only for reading the login from XML.voidsetTableQualifier(String qualifier) PUBLIC: Set the default qualifier for all tables.voidsetTimestampQuery(ValueReadQuery timestampQuery) PUBLIC: Override the default query for returning a timestamp from the server.voidsetUserName(String name) PUBLIC: The user name is the database login name.voidsetUsesExternalConnectionPooling(boolean usesExternalConnectionPooling) PUBLIC: Return whether EclipseLink uses some external connection pooling service such as a JDBC 2.0 driver.voidsetUsesExternalTransactionController(boolean usesExternalTransactionController) PUBLIC: Return whether EclipseLink uses some external transaction service such as JTS.booleanINTERNAL: Used for cache isolation.booleanINTERNAL: Used for cache isolation.booleanINTERNAL: Used for Cache Isolation.booleanINTERNAL: Used for Cache Isolation.booleanINTERNAL: Used for Cache Isolation.booleanPUBLIC: Return whether EclipseLink uses some external connection pooling (e.g.booleanPUBLIC: Return whether EclipseLink uses some external transaction service such as JTS.toString()PUBLIC: Print all of the connection information.voidPUBLIC: Use external connection pooling.voidPUBLIC: Use an external transaction controller such as a JTS servicevoidusePlatform(org.eclipse.persistence.internal.databaseaccess.Platform platform) ADVANCED: Set the database platform to be custom platform.Methods inherited from class java.lang.Objectequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.persistence.sessions.LoginbuildAccessor
- 
Field Details- 
versionString
- 
propertiesConnection properties (e.g. user, password, and driver-specific settings)
- 
platformprotected org.eclipse.persistence.internal.databaseaccess.Platform platformImplementation of platform-specific behaviors.
- 
connectorProvide a little flexibility for connecting to a database
- 
usesExternalConnectionPoolingprotected boolean usesExternalConnectionPoolingTrue if we use an external connection pool such as WebLogic's JTS driver
- 
usesExternalTransactionControllerprotected boolean usesExternalTransactionControllerTrue if we should use some external transaction service such as JTS.
- 
cacheTransactionIsolationprotected int cacheTransactionIsolationBy default concurrency is optimized and the cache is not locked during reads or writes, This allows for concurrent reading and writing and should never cause any problems. If the application uses no form of locking the last unit of work to merge changes will win, with no locking it is possible only under this scenario for two unit of works to merge changes different than the database although highly unlikely and if occurred is the entire purpose of locking. This property allows for the isolation level of changes to the cache to be configured for sever situation and it is not suggest that this be changed.
- 
CONCURRENT_READ_WRITEpublic static final int CONCURRENT_READ_WRITEReads and unit of work merges can occur concurrently.- See Also:
 
- 
SYNCHRONIZED_WRITEpublic static final int SYNCHRONIZED_WRITEReads can occur concurrently but unit of work merges will be serialized.- See Also:
 
- 
SYNCHRONIZED_READ_ON_WRITEpublic static final int SYNCHRONIZED_READ_ON_WRITEReads and unit of work merges will be serialized.- See Also:
 
- 
SYNCRONIZED_OBJECT_LEVEL_READ_WRITEpublic static final int SYNCRONIZED_OBJECT_LEVEL_READ_WRITEWrites to the cache (merge, object build/refresh will be synchronized as will cache access (cloning) based on when access is required.- See Also:
 
- 
SYNCRONIZED_OBJECT_LEVEL_READ_WRITE_DATABASEpublic static final int SYNCRONIZED_OBJECT_LEVEL_READ_WRITE_DATABASEWrites to the cache (merge, object build/refresh will be synchronized as will cache access (cloning) based on database transaction.- See Also:
 
 
- 
- 
Constructor Details- 
DatasourceLoginpublic DatasourceLogin()PUBLIC: Create a new login.
- 
DatasourceLoginpublic DatasourceLogin(org.eclipse.persistence.internal.databaseaccess.Platform databasePlatform) ADVANCED: Create a new login for the given platform.
 
- 
- 
Method Details- 
getSecurableObjectHolderprotected org.eclipse.persistence.internal.security.SecurableObjectHolder getSecurableObjectHolder()INTERNAL: Return the encryption securable holder. Lazy initialize to handle serialization.
- 
cloneINTERNAL: Clone the login. This also clones the platform as it is internal to the login.
- 
connectToDatasourcepublic Object connectToDatasource(org.eclipse.persistence.internal.databaseaccess.Accessor accessor, Session session) throws DatabaseException INTERNAL: Connect to the datasource, and return the driver level connection object.- Specified by:
- connectToDatasourcein interface- Login
- Throws:
- DatabaseException
 
- 
getCacheTransactionIsolationpublic int getCacheTransactionIsolation()ADVANCED: By default concurrency is optimized and the cache is not locked more than required during reads or writes, This allows for virtual concurrent reading and writing and should never cause any problems. If the application uses no form of locking the last unit of work to merge changes will win, with no locking it is possible only under this scenario for two unit of works to merge changes different than the database although highly unlikely and if occurred is the entire purpose of locking and locking is the suggested solution if this is a problem. This property allows for the isolation level of changes to the cache to be configured for sever situations and it is not suggest that this be changed.Setting are: - ConcurrentReadWrite - default
- SynchronizedWrite - only allow a single writer (i.e. unit of work merge) to the cache at once
- SynchronizedReadOnWrite - do not allow reading or other unit of work merge while a unit of work is in merge
 
- 
getConnectorADVANCED: Return the connector that will instantiate the connection.
- 
getPlatformINTERNAL: Return the database platform specific information. This allows EclipseLink to configure certain advanced features for the database desired. NOTE: this must only be used for relational specific usage and will not work for non-relational datasources.- Specified by:
- getPlatformin interface- Login
 
- 
getDatasourcePlatformpublic org.eclipse.persistence.internal.databaseaccess.Platform getDatasourcePlatform()PUBLIC: Return the datasource platform specific information. This allows EclipseLink to configure certain advanced features for the datasource desired.- Specified by:
- getDatasourcePlatformin interface- CoreLogin<org.eclipse.persistence.internal.databaseaccess.Platform>
- Specified by:
- getDatasourcePlatformin interface- Login
 
- 
getPropertiesINTERNAL: The properties are additional, driver-specific, connection information to be passed to the driver.NOTE: Do not set the password directly by getting the properties and setting the "password" property directly. Use the method DatabaseLogin.setPassword(String). 
- 
getPropertyPUBLIC: The properties are additional, driver-specific, connection information to be passed to the driver.NOTE: Do not set the password directly by getting the properties and setting the "password" property directly. Use the method DatabaseLogin.setPassword(String). - Specified by:
- getPropertyin interface- Login
 
- 
getTableQualifierPUBLIC: Return the qualifier for the all of the tables referenced by EclipseLink. This can be the creator of the table or database name the table exists on. This is required by some databases such as Oracle and DB2. This should only be used if all of the tables have the same qualifier. It can also be set on each descriptor when the table name is specified.- Specified by:
- getTableQualifierin interface- Login
 
- 
getUserNamePUBLIC: The user name is the database login name. Some databases do not require a user name or the user is obtained from the OS, in this case the user name not be specified.- Specified by:
- getUserNamein interface- Login
 
- 
isConnectionHealthValidatedOnErrorpublic boolean isConnectionHealthValidatedOnError()PUBLIC: This value defaults to false when not on a DatabaseLogin as the functionality has not been implemented for other datasource type. On an SQL Exception EclipseLink will ping the database to determine if the connection used can continue to be used for queries. This should have no impact on applications unless the user is using pessimistic locking queries with 'no wait' or are using a query timeout feature. If that is the case and the application is experiencing a performance impact from the health check then this feature can be turned off. Turning this feature off will prevent EclipseLink from being able to retry queries in the case of database failure.- Specified by:
- isConnectionHealthValidatedOnErrorin interface- Login
 
- 
getVersionPUBLIC: Return the EclipseLink version.- Returns:
- version of EclipseLink
 
- 
removePropertyPUBLIC: Some drivers don't like the "user" and "password" properties. They can be removed with this method, or by using setUserName(null) / setPassword(null)
- 
setCacheTransactionIsolationpublic void setCacheTransactionIsolation(int cacheTransactionIsolation) ADVANCED: By default concurrency is optimized and the cache is not locked more than required during reads or writes, This allows for virtual concurrent reading and writing and should never cause any problems. If the application uses no form of locking the last unit of work to merge changes will win, with no locking it is possible only under this scenario for two unit of works to merge changes different than the database although highly unlikely and if occurred is the entire purpose of locking and locking is the suggested solution if this is a problem. This property allows for the isolation level of changes to the cache to be configured for sever situations and it is not suggest that this be changed.Setting are: - ConcurrentReadWrite - default
- SynchronizedWrite - only allow a single writer (i.e. unit of work merge) to the cache at once
- SynchronizedReadOnWrite - do not allow reading or other unit of work merge while a unit of work is in merge
 
- 
setConnectorPUBLIC: Set the connector that will instantiate the connection. As an example, to use a JNDI-suppliedDataSource, use code something like the following:
 where thesession.getLogin().setConnector(new JNDIConnector(context, dataSourceName));
 session.login();contextis an instance of ajavax.naming.Contextand thedataSourceNamerefers to the name of theDataSourcewithin the context.
- 
setDefaultNullValuePUBLIC: The default value to substitute for database NULLs can be configured on a per-class basis. Example: login.setDefaultNullValue(long.class, Long.valueOf(0))
- 
setPasswordSet the password.- Specified by:
- setPasswordin interface- Login
 
- 
getPasswordReturn the password. It will be encrypted.- Specified by:
- getPasswordin interface- Login
 
- 
setEncryptedPasswordSet the encrypted password.
- 
setEncryptionClassNameSets the encryption class name
- 
setPlatformpublic void setPlatform(org.eclipse.persistence.internal.databaseaccess.Platform platform) INTERNAL: Set the database platform specific information. This allows EclipseLink to configure certain advanced features for the database desired.- Specified by:
- setPlatformin interface- Login
 
- 
setDatasourcePlatformpublic void setDatasourcePlatform(org.eclipse.persistence.internal.databaseaccess.Platform platform) PUBLIC: Set the database platform specific information. This allows EclipseLink to configure certain advanced features for the database desired.- Specified by:
- setDatasourcePlatformin interface- Login
 
- 
getPlatformClassNameINTERNAL: Return the name of the database platform class.
- 
setPlatformClassNameINTERNAL: Set the name of the Platform to be used. Creates a new instance of the specified Class.- Throws:
- ValidationException
 
- 
setPlatformClassNamepublic void setPlatformClassName(String platformClassName, ClassLoader loader) throws ValidationException INTERNAL: Set the name of the Platform to be created using the passed in class loader. If no class loader is passed in, of if an exception is thrown, call the setPlatformClassName method with no classloader.- Throws:
- ValidationException
- See Also:
 
- 
usePlatformpublic void usePlatform(org.eclipse.persistence.internal.databaseaccess.Platform platform) ADVANCED: Set the database platform to be custom platform.
- 
setPropertiesPUBLIC: The properties are additional, driver-specific, connection information to be passed to the JDBC driver.- Specified by:
- setPropertiesin interface- Login
 
- 
setPropertyPUBLIC: Some JDBC drivers require additional, driver-specific, properties. Add the specified property to those to be passed to the JDBC driver.- Specified by:
- setPropertyin interface- Login
 
- 
setTableQualifierPUBLIC: Set the default qualifier for all tables. This can be the creator of the table or database name the table exists on. This is required by some databases such as Oracle and DB2.
- 
setTimestampQueryPUBLIC: Override the default query for returning a timestamp from the server.
- 
setUserNamePUBLIC: The user name is the database login name. Some databases do not require a user name or the user is obtained from the OS, in this case this should not be specified.- Specified by:
- setUserNamein interface- Login
 
- 
setUsesExternalConnectionPoolingpublic void setUsesExternalConnectionPooling(boolean usesExternalConnectionPooling) PUBLIC: Return whether EclipseLink uses some external connection pooling service such as a JDBC 2.0 driver.
- 
setUsesExternalTransactionControllerpublic void setUsesExternalTransactionController(boolean usesExternalTransactionController) PUBLIC: Return whether EclipseLink uses some external transaction service such as JTS.
- 
dontUseExternalConnectionPoolingpublic void dontUseExternalConnectionPooling()PUBLIC: Do not use external connection pooling. This is appropriate if using regular EclipseLink connection pooling and regular JDBC drivers.- See Also:
 
- 
dontUseExternalTransactionControllerpublic void dontUseExternalTransactionController()PUBLIC: Let EclipseLink control transactions instead of some external transaction service such as JTS.- See Also:
 
- 
shouldAllowConcurrentReadWritepublic boolean shouldAllowConcurrentReadWrite()INTERNAL: Used for cache isolation.- Specified by:
- shouldAllowConcurrentReadWritein interface- Login
 
- 
shouldSynchronizedReadOnWritepublic boolean shouldSynchronizedReadOnWrite()INTERNAL: Used for cache isolation.- Specified by:
- shouldSynchronizedReadOnWritein interface- Login
 
- 
shouldSynchronizeWritespublic boolean shouldSynchronizeWrites()INTERNAL: Used for Cache Isolation. Causes EclipseLink to lock at the class level on cache updates.- Specified by:
- shouldSynchronizeWritesin interface- Login
 
- 
shouldSynchronizeObjectLevelReadWritepublic boolean shouldSynchronizeObjectLevelReadWrite()INTERNAL: Used for Cache Isolation. Causes EclipseLink to lock at the object level on cache updates and cache access.- Specified by:
- shouldSynchronizeObjectLevelReadWritein interface- Login
 
- 
shouldSynchronizeObjectLevelReadWriteDatabasepublic boolean shouldSynchronizeObjectLevelReadWriteDatabase()INTERNAL: Used for Cache Isolation. Causes EclipseLink to lock at the object level on cache updates and cache access, based on database transaction.- Specified by:
- shouldSynchronizeObjectLevelReadWriteDatabasein interface- Login
 
- 
shouldUseExternalConnectionPoolingpublic boolean shouldUseExternalConnectionPooling()PUBLIC: Return whether EclipseLink uses some external connection pooling (e.g. WebLogic's JTS driver).- Specified by:
- shouldUseExternalConnectionPoolingin interface- Login
- See Also:
 
- 
shouldUseExternalTransactionControllerpublic boolean shouldUseExternalTransactionController()PUBLIC: Return whether EclipseLink uses some external transaction service such as JTS.- Specified by:
- shouldUseExternalTransactionControllerin interface- Login
- See Also:
 
- 
useExternalConnectionPoolingpublic void useExternalConnectionPooling()PUBLIC: Use external connection pooling.
- 
useExternalTransactionControllerpublic void useExternalTransactionController()PUBLIC: Use an external transaction controller such as a JTS service
- 
toStringPUBLIC: Print all of the connection information.
- 
getDefaultSequenceGet default sequence
- 
setDefaultSequenceSet default sequence
- 
addSequenceAdd sequence corresponding to the name Don't use if the session is connected.
- 
getSequenceGet sequence corresponding to the name
- 
getSequencesReturns a map of sequence names to Sequences (may be null).
- 
removeSequenceRemove sequence corresponding to name. Doesn't remove default sequence. Don't use if the session is connected.
- 
removeAllSequencespublic void removeAllSequences()Remove all sequences but the default one.
- 
getDefaultSequenceToWriteINTERNAL: Used only for writing the login into XML or Java.
- 
getSequencesToWriteINTERNAL: Used only for writing the login into XML or Java.
- 
setSequencesINTERNAL: Used only for reading the login from XML.
 
-