Annotation Type DataSourceDefinition
-
@Target(TYPE) @Retention(RUNTIME) @Repeatable(DataSourceDefinitions.class) public @interface DataSourceDefinition
Annotation used to define a containerDataSource
to be registered with JNDI. TheDataSource
may be configured by setting the annotation elements for commonly usedDataSource
properties. Additional standard and vendor-specific properties may be specified using theproperties
element.The data source will be registered under the name specified in the
name
element. It may be defined to be in any valid Jakarta EE namespace, which will determine the accessibility of the data source from other components.A JDBC driver implementation class of the appropriate type, either
DataSource
,ConnectionPoolDataSource
, orXADataSource
, must be indicated by theclassName
element. The availability of the driver class will be assumed at runtime.DataSource properties should not be specified more than once. If the url annotation element contains a DataSource property that was also specified using the corresponding annotation element or was specified in the properties annotation element, the precedence order is undefined and implementation specific:
{@snippet :
- Since:
- Common Annotations 1.1
- See Also:
DataSource
,XADataSource
,ConnectionPoolDataSource
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description java.lang.String
className
Name of a DataSource class that implementsjavax.sql.DataSource
orjavax.sql.XADataSource
orjavax.sql.ConnectionPoolDataSource
.java.lang.String
name
JNDI name by which the data source will be registered.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.String
databaseName
Name of a database on a server.java.lang.String
description
Description of this data sourceint
initialPoolSize
Number of connections that should be created when a connection pool is initialized.int
isolationLevel
Isolation level for connections.int
loginTimeout
Sets the maximum time in seconds that this data source will wait while attempting to connect to a database.int
maxIdleTime
The number of seconds that a physical connection should remain unused in the pool before the connection is closed for a connection pool.int
maxPoolSize
Maximum number of connections that should be concurrently allocated for a connection pool.int
maxStatements
The total number of statements that a connection pool should keep open.int
minPoolSize
Minimum number of connections that should be allocated for a connection pool.java.lang.String
password
Password to use for connection authentication.int
portNumber
Port number where a server is listening for requests.java.lang.String[]
properties
Used to specify vendor-specific properties and less commonly usedDataSource
properties such as: dataSourceName networkProtocol propertyCycle roleName Properties are specified using the format: propertyName=propertyValue with one property per array element.java.lang.String
serverName
Database server name.boolean
transactional
Set tofalse
if connections should not participate in transactions.java.lang.String
url
A JDBC URL.java.lang.String
user
User name to use for connection authentication.
-
-
-
-
isolationLevel
int isolationLevel
Isolation level for connections. The Isolation level must be one of the following:- Connection.TRANSACTION_NONE,
- Connection.TRANSACTION_READ_ UNCOMMITTED,
- Connection.TRANSACTION_READ_COMMITTED,
- Connection.TRANSACTION_REPEATABLE_READ,
- Connection.TRANSACTION_SERIALIZABLE
- Since:
- 1.1
- Default:
- -1
-
-
-
properties
java.lang.String[] properties
Used to specify vendor-specific properties and less commonly usedDataSource
properties such as:- dataSourceName
- networkProtocol
- propertyCycle
- roleName
If a DataSource property is specified in the
properties
element and the annotation element for the property is also specified, the annotation element value takes precedence.- Since:
- 1.1
- Default:
- {}
-
-
-
loginTimeout
int loginTimeout
Sets the maximum time in seconds that this data source will wait while attempting to connect to a database. A value of zero specifies that the timeout is the default system timeout if there is one; otherwise, it specifies that there is no timeout.Default is vendor-specific.
- Since:
- 1.1
- Default:
- 0
-
-