Skip to content

Commit c94f087

Browse files
Added lazy documentation
1 parent 2eedf70 commit c94f087

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
* Updated org.springframework.boot.version to v3.4.0
44
* Updated EclipseStore to v2.0.0
5+
* Implemented Lazy Repositories with ``LazyEclipseStoreRepository``
56

67
# 2.3.1
78

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ the [demos](./spring-data-eclipse-store-demo):
6666

6767
* [Simple demo](https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/simple)
6868
* [Complex demo](https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex)
69+
* [Lazy demo](https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/lazy)
6970
* [Demo with coexisting JPA](https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store-jpa/src/main/java/software/xdev/spring/data/eclipse/store/jpa)
7071
* [Dual storage demo](https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage)
7172

docs/modules/ROOT/pages/features/lazies.adoc

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,34 @@ public class Owner extends Person
3131
//...
3232
----
3333

34+
== Repositories
35+
36+
Entities in a repository are by default **not lazy**.
37+
But we made it as easy as possible for you to make these entities lazy: Instead of extending the ``EclipseStoreRepository`` (or any similar class from the ``software.xdev.spring.data.eclipse.store.repository.interfaces``-Package), you simply extend the ``LazyEclipseStoreRepository``.
38+
39+
=== https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/lazy/CustomerRepository.java[Example from lazy demo]
40+
41+
[source,java,title="https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/simple/CustomerRepository.java[Before (not lazy)]"]
42+
----
43+
public interface CustomerRepository extends CrudRepository<Customer, String>
44+
{
45+
}
46+
----
47+
48+
[source,java,title="https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/lazy/CustomerRepository.java[After (lazy)]"]
49+
----
50+
public interface CustomerRepository extends LazyEclipseStoreCrudRepository<Customer, String>
51+
{
52+
}
53+
----
54+
55+
Every instance of the ``Customer``-Entities are now wrapped in a https://docs.eclipsestore.io/manual/storage/loading-data/lazy-loading/index.html[``Lazy``-Reference].
56+
That means that these objects are **only loaded from the storage, if they are needed** e.g. when ``findAll`` is called.
57+
58+
The method **``findById`` only loads the entities with the corresponding IDs**, because a separate list with all ids is stored.
59+
But if any method like **``findByName`` or ``findByChild`` is used, all objects are loaded** from the storage.
60+
This is currently the only way to get the actual values of the entities.
61+
3462
== Internals
3563

3664
SpringDataEclipseStoreLazies work as a proxy for the EclipseStore-Lazies.

0 commit comments

Comments
 (0)