Skip to content

Commit 2afc7e7

Browse files
Merge branch 'develop' into renovate/antora-cli-3.x
2 parents 8b94b65 + fe3469b commit 2afc7e7

255 files changed

Lines changed: 2410 additions & 383 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/antora-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
run: npx antora docs/antora-playbook.yml
3636

3737
- name: Setup Pages
38-
uses: actions/configure-pages@v4
38+
uses: actions/configure-pages@v5
3939

4040
- name: Upload artifact
4141
uses: actions/upload-pages-artifact@v3

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# 1.0.4
22

33
* Added possibility to use multiple storages
4+
* Added Lazy support
5+
* Updated EclipseStore to version 1.3.1
46

57
# 1.0.3
68

docs/modules/ROOT/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
* xref:installation.adoc[Installation]
33
* xref:configuration.adoc[Configuration]
44
* xref:working-copies.adoc[Working Copies]
5+
* xref:lazies.adoc[Lazy References]
56
* xref:migration.adoc[Migration]
67
* xref:known-issues.adoc[Known issues]

docs/modules/ROOT/pages/known-issues.adoc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
= Known issues
22

3-
== Lazy references
4-
5-
One of the core features of EclipseStore is its https://docs.eclipsestore.io/manual/storage/loading-data/lazy-loading/index.html[Lazy references].
6-
Unfortunately this requires our library to implement some kind of proxy.
7-
That's something that takes a lot of effort to implement in our {product-name}.
8-
9-
We created https://github.com/xdev-software/spring-data-eclipse-store/issues/31[an issue] for that but right now we *do not support Lazy references*.
10-
113
== Query annotations
124

135
In Spring-Data-JPA you can write a Query over methods of repositories like this:
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
= Lazy References
2+
3+
Lazy Loading is an essential part of EclipseStore.
4+
The basic mechanism is best explained in the https://docs.eclipsestore.io/manual/storage/loading-data/lazy-loading/index.html[EclipseStore-Docs]. +
5+
In essence java objects which are wrapped in a *Lazy-Reference are not loaded with the startup of the EclipseStore-Storage but only if ``get()`` is called* on them.
6+
7+
Lazy References are essential for big data sets that can't get loaded into memory.
8+
Since {product-name} operates with xref:working-copies.adoc[working copies] using the EclipseStore-Lazy-References is not possible. +
9+
If you are using the EclipseStore-Lazy-References, all references would be resolved and loaded into memory as soon as a working copy is created, because the ``get()``-Method is called to create a full working copy.
10+
11+
That's why we implemented ``SpringDataEclipseStoreLazy``. +
12+
The usage is the same as with the EclipseStore-Lazies, but they are handled very differently.
13+
14+
Simply wrap any kind of java object in the SpringDataEclipseStoreLazy-Wrapper and the wrapped object has a lazy loading behaviour.
15+
16+
CAUTION: Lazy-References are not only loaded when needed, but also https://docs.eclipsestore.io/manual/storage/loading-data/lazy-loading/clearing-lazy-references.html#automatically[*cleared when they are no longer needed*]!
17+
18+
Example: ``SpringDataEclipseStoreLazy.build(new HashMap<String, Pet>())``
19+
20+
[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/complex/owner/Owner.java[Example from complex demo]"]
21+
----
22+
package software.xdev.spring.data.eclipse.store.demo.complex.owner;
23+
//...
24+
import software.xdev.spring.data.eclipse.store.repository.lazy.SpringDataEclipseStoreLazy;
25+
26+
public class Owner extends Person
27+
{
28+
private String address;
29+
30+
private Lazy<List<Pet>> pets = SpringDataEclipseStoreLazy.build(new ArrayList<>());
31+
//...
32+
----
33+
34+
== Internas
35+
36+
SpringDataEclipseStoreLazies work as a proxy for the EclipseStore-Lazies.
37+
As far as EclipseStore is concerned, a SpringDataEclipseStoreLazy-Object is a normal Java object that contains a Lazy-Reference.
38+
39+
But when {product-name} creates the working copy, *the SpringDataEclipseStoreLazy-Reference is not resolved* but instead only a reference to the original Lazy-Object in EclipseStore is loaded.
40+
As soon as ``get()`` is called on the SpringDataEclipseStoreLazy, a *new working copy of the lazy object* is created.

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
},
55
"devDependencies": {
66
"@antora/cli": "3.1.7",
7-
"@antora/site-generator": "3.1.4"
7+
"@antora/site-generator": "3.1.7"
88
}
99
}

spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex/ComplexDemoApplication.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,17 @@ public void run(final String... args)
103103
);
104104
}
105105
);
106+
107+
LOG.info("----Owner-Lazy Pet loading----");
108+
this.ownerRepository.findAll().forEach(
109+
o -> o.getPets().forEach(
110+
pet -> LOG.info(String.format(
111+
"Pet %s has owner %s %s",
112+
pet.getName(),
113+
o.getFirstName(),
114+
o.getLastName()))
115+
)
116+
);
106117
}
107118

108119
private static Visit createVisit()

spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex/owner/Owner.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919
import java.util.List;
2020
import java.util.Optional;
2121

22+
import org.eclipse.serializer.reference.Lazy;
2223
import org.springframework.core.style.ToStringCreator;
2324
import org.springframework.util.Assert;
2425

2526
import software.xdev.spring.data.eclipse.store.demo.complex.model.Person;
27+
import software.xdev.spring.data.eclipse.store.repository.lazy.SpringDataEclipseStoreLazy;
2628

2729

2830
public class Owner extends Person
@@ -33,7 +35,7 @@ public class Owner extends Person
3335

3436
private String telephone;
3537

36-
private final List<Pet> pets = new ArrayList<>();
38+
private Lazy<List<Pet>> pets = SpringDataEclipseStoreLazy.build(new ArrayList<>());
3739

3840
public String getAddress()
3941
{
@@ -52,7 +54,12 @@ public String getTelephone()
5254

5355
public List<Pet> getPets()
5456
{
55-
return this.pets;
57+
return this.pets.get();
58+
}
59+
60+
public void setPets(final List<Pet> pets)
61+
{
62+
this.pets = SpringDataEclipseStoreLazy.build(pets);
5663
}
5764

5865
public void addPet(final Pet pet)

spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex/owner/OwnerRepository.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
package software.xdev.spring.data.eclipse.store.demo.complex.owner;
1717

18+
import java.util.List;
19+
1820
import org.springframework.data.domain.Page;
1921
import org.springframework.data.domain.Pageable;
2022
import org.springframework.data.repository.Repository;
@@ -28,5 +30,7 @@ public interface OwnerRepository extends Repository<Owner, Integer>
2830

2931
Page<Owner> findAll(Pageable pageable);
3032

33+
List<Owner> findAll();
34+
3135
void deleteAll();
3236
}

spring-data-eclipse-store-jpa/src/test/java/software/xdev/spring/data/eclipse/store/jpa/integration/repository/PersonToTestInEclipseStoreRepository.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreListCrudRepository;
44

55

6-
public interface PersonToTestInEclipseStoreRepository extends EclipseStoreListCrudRepository<PersonToTestInEclipseStore, String>
6+
public interface PersonToTestInEclipseStoreRepository
7+
extends EclipseStoreListCrudRepository<PersonToTestInEclipseStore, String>
78
{
89
}

0 commit comments

Comments
 (0)