Skip to content

Commit 4946f8a

Browse files
committed
attempt to respecify dataSource
to reflect what we're actually doing with this in practice
1 parent f086d0d commit 4946f8a

1 file changed

Lines changed: 26 additions & 18 deletions

File tree

api/src/main/java/jakarta/data/repository/Repository.java

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,21 @@
6666
@Target(ElementType.TYPE)
6767
public @interface Repository {
6868
/**
69-
* Value for the {@link Repository#provider()} attribute that allows the use
70-
* of any available Jakarta Data provider that supports the type of entity
71-
* annotation that is present on the repository's entity class.
69+
* Value for the {@link #provider()} attribute that allows the use of
70+
* any available Jakarta Data provider that supports the type of entity
71+
* annotation that is present on the repository's entity classes.
7272
*/
7373
String ANY_PROVIDER = "";
7474

7575
/**
76-
* <p>Value for the {@link Repository#dataStore()} attribute that indicates
77-
* to use
76+
* <p>Value for the {@link #dataStore()} attribute that indicates use of
7877
* a default data store.</p>
7978
*
80-
* <p>When running in a Jakarta EE profile or platform and the entity
81-
* annotations
82-
* indicate a relational database, the default data store is the Jakarta EE
83-
* default data source, {@code java:comp/DefaultDataSource}. Otherwise, the
84-
* default data store is determined by the Jakarta Data provider.</p>
79+
* <p>In a Jakarta EE profile or platform environment, if the repository
80+
* implementation requires direct access to a {@code javax.sql.DataSource},
81+
* the default data store is the Jakarta EE default data source with name
82+
* {@code java:comp/DefaultDataSource}. Otherwise, the default data store
83+
* is determined by the Jakarta Data provider.</p>
8584
*
8685
* <p>The default data store might require additional vendor-specific
8786
* configuration, depending on the vendor.</p>
@@ -100,14 +99,23 @@
10099
* Interoperability with Jakarta Config is reserved for future versions
101100
* of Jakarta Data.
102101
* </li>
103-
* <li>If running in a Jakarta EE profile or platform and the entity annotations
104-
* indicate a relational database and the value begins with {@code java:} and
105-
* matches the name of a {@code jakarta.annotation.sql.DataSourceDefinition},
106-
* the JNDI name of a data source, or a resource reference to a data source,
107-
* then the corresponding {@code javax.sql.DataSource} is used as the data store.
108-
* If the same conditions are met but the value matches a persistence unit
109-
* reference, then the corresponding {@code jakarta.persistence.PersistenceUnit}
110-
* is used as the data store.
102+
* <li>In a Jakarta EE profile or platform environment, if the repository
103+
* implementation requires direct access to a {@code javax.sql.DataSource}
104+
* and if the value begins with {@code java:} and matches the name of a
105+
* {@code jakarta.annotation.sql.DataSourceDefinition}, the JNDI name of
106+
* a {@code DataSource}, or a resource reference to a {@code DataSource},
107+
* then the corresponding {@code DataSource} obtained from JNDI is used.
108+
* </li>
109+
* <li>In a Jakarta EE profile or platform environment, if the repository
110+
* implementation requires direct access to a Jakarta Persistence
111+
* {@code jakarta.persistence.EntityManagerFactory} and if the value does
112+
* not begin with {@code java:} and matches the name of a persistence unit,
113+
* then the container-managed {@code EntityManagerFactory} for that
114+
* persistence unit is used, obtained as if it had been injected using the
115+
* {@code PersistenceUnit} annotation. Or, if the value does begin with
116+
* {@code java:} and matches the name of a persistence unit reference,
117+
* then the corresponding {@code EntityManagerFactory} obtained from JNDI
118+
* is used.
111119
* </li>
112120
* <li>Otherwise, the value serves as an identifier linking to vendor-specific
113121
* configuration for the Jakarta Data provider to interpret in a vendor-specific

0 commit comments

Comments
 (0)