Skip to content

Commit 37c0436

Browse files
committed
Add a note to the docs about non-default PU in Jakarta Data repositories
1 parent 21d5941 commit 37c0436

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

docs/src/main/asciidoc/hibernate-orm.adoc

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1817,10 +1817,28 @@ public class MyEntityResource {
18171817
repository.insert(entity);
18181818
}
18191819
1820-
// ...
1820+
// ...
1821+
1822+
}
1823+
----
1824+
1825+
[NOTE]
1826+
====
1827+
When working with non-default persistence units, remember to specify the persistence unit name the repository is targeting
1828+
in the `dataStore` attribute of the repository annotation:
18211829
1830+
[source,java]
1831+
----
1832+
@Repository(dataStore = "other") // <1>
1833+
public interface MyNonDefaultPURepository {
1834+
// ...
18221835
}
18231836
----
1837+
1. Pass the name of the non-default persistence unit to the repository annotation (`other` in this example).
1838+
1839+
Review the https://jakarta.ee/specifications/data/1.0/apidocs/jakarta.data/jakarta/data/repository/repository#dataStore()[Javadoc of the `@Repository` annotation]
1840+
to learn more about the `dataStore` attribute.
1841+
====
18241842

18251843
Please refer to the corresponding https://hibernate.org/repositories/[Hibernate Data Repositories]
18261844
and https://jakarta.ee/specifications/data/1.0/jakarta-data-1.0[Jakarta Data]

0 commit comments

Comments
 (0)