Skip to content

Commit d16507a

Browse files
Merge pull request #229 from xdev-software/develop
v2.5.1
2 parents 6a76d1b + ab02289 commit d16507a

File tree

19 files changed

+421
-65
lines changed

19 files changed

+421
-65
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 2.5.1
2+
3+
* Simplified configuration injection in ``EclipseStoreRepositoryFactoryBean``.
4+
* Updated EclipseStore to v2.1.1
5+
* Updated org.springframework.boot.version to v3.4.2
6+
17
# 2.5.0
28

39
* Updated org.springframework.boot.version to v3.4.1

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ instructions** are in the documentation](https://xdev-software.github.io/spring-
5959
| ``2.2.0-2.3.1`` | ``17`` | ``3.3.4`` | ``1.4.0`` |
6060
| ``2.4.0`` | ``17`` | ``3.4.0`` | ``2.0.0`` |
6161
| ``2.4.1`` | ``17`` | ``3.4.0`` | ``2.1.0`` |
62-
| ``>= 2.5.0`` | ``17`` | ``3.4.1`` | ``2.1.0`` |
62+
| ``2.5.0`` | ``17`` | ``3.4.1`` | ``2.1.0`` |
63+
| ``>= 2.5.1`` | ``17`` | ``3.4.2`` | ``2.1.1`` |
6364

6465
## Demo
6566

@@ -86,6 +87,12 @@ the [demos](./spring-data-eclipse-store-demo):
8687
If you need support as soon as possible, and you can't wait for any pull request, feel free to
8788
use [our support](https://xdev.software/en/services/support).
8889
90+
## Additional Information
91+
92+
* [Recording of an introduction talk at JUG Bangalore](https://www.youtube.com/watch?v=OlGZ2Hr0FdA)
93+
* [Recording of an introduction talk at JCON 2024](https://youtu.be/-WBbKUGeYBw?si=utZRlY9b2twQLxW8)
94+
* Blog-Article: [Minimize Costs by Utilizing Cloud Storage with Spring-Data-Eclipse-Store](https://foojay.io/today/minimize-costs-by-utilizing-cloud-storage-with-spring-data-eclipse-store/)
95+
8996
## Contributing
9097
See the [contributing guide](./CONTRIBUTING.md) for detailed instructions on how to get started with our project.
9198

docs/modules/ROOT/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@
1212
** xref:features/rest-api.adoc[REST Interface]
1313
** xref:features/validation-constraints.adoc[Validation Constraints]
1414
* xref:migration-from-jpa.adoc[Migration from JPA]
15+
* xref:migration-from-eclipse-store.adoc[Migration from EclipseStore]
1516
* xref:known-issues.adoc[Known issues]

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ That consists of https://docs.eclipsestore.io/manual/storage/legacy-type-mapping
1313

1414
=== Values
1515

16-
There is a library to version your data in the store called https://github.com/xdev-software/micro-migration[XDEV MicroMigration].
17-
This helps you keep your data up to date regardless of the current version.
18-
19-
We created https://github.com/xdev-software/spring-data-eclipse-store/issues/33[an issue] for that but right now we *do not support XDEVs MicroMigration*.
16+
Keeping data up-to-date is made easy through https://github.com/xdev-software/micro-migration[XDEV's MicroMigration] explained in detail in xref:features/versioned-migration.adoc[Versioned Migration].
2017

2118
== Spring Developer Tools [[spring-dev-tools]]
2219

@@ -41,12 +38,12 @@ Consequently, finding such a relationship requires searching the entire object g
4138

4239
image::DependingClasses.svg[Example structure with orders and articles]
4340

44-
Example Scenario:
41+
=== Example Scenario
4542
Consider an *order object* that contains references to several *article objects*.
4643
In this case, determining which order contains a specific article is nearly impossible without traversing the entire object graph to locate it.
4744
This lack of direct reference contrasts sharply with the behavior of SQL databases.
4845

49-
What Happens When an Article is Deleted?
46+
=== What Happens When an Article is Deleted?
5047

5148
1. In an *SQL Database*: +
5249
Attempting to delete an article that is still referenced (e.g., by an order) would typically result in an exception. +
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
= Migration from EclipseStore
2+
3+
Given the flexibility of EclipseStore and its diverse use cases, there is **no universal, one-size-fits-all solution for migrating data** between the two systems.
4+
5+
The first step is to define the appropriate entities and repositories tailored to your requirements, ensuring they align with the existing data structure in EclipseStore.
6+
7+
Next, the data must be transferred to the Spring-Data-Eclipse-Store storage.
8+
To facilitate this, both EclipseStore and {product-name} must run within the same JVM (Java Virtual Machine).
9+
This configuration enables the developer to operate both systems simultaneously and transfer data by making simple ``save`` calls to the respective repositories.
10+
11+
== Example
12+
13+
=== 0. Status Quo
14+
15+
Let's say that this is the current state of the code:
16+
17+
[source,java,title="``package software.xdev.example.eclipse.store``"]
18+
----
19+
public record Root(List<Owner> owners, List<Vet> vets){}
20+
public record Owner(String name, List<Pet> pets, List<Visit> visits){}
21+
public record Pet(String name){}
22+
public record Vet(String name, List<Owner> clients){}
23+
public record Visit(LocalDate date, Owner owner, Pet pet){}
24+
----
25+
26+
In this case ``Root`` is the root-object of EclipseStore.
27+
28+
=== 1. Building Repositories
29+
30+
Now entities with its corresponding repositories must be created in the same project:
31+
32+
[source,java,title="``package software.xdev.example.sdes.enitities``"]
33+
----
34+
public class Owner{
35+
@Id
36+
@GeneratedValue(strategy = GenerationType.AUTO)
37+
private long id;
38+
private final String name;
39+
private final List<Pet> pets;
40+
private final List<Visit> visits;
41+
//...
42+
}
43+
public class Vet{
44+
@Id
45+
@GeneratedValue(strategy = GenerationType.AUTO)
46+
private long id;
47+
private final String name;
48+
private final List<Owner> clients;
49+
//...
50+
}
51+
public class Visit{
52+
@Id
53+
@GeneratedValue(strategy = GenerationType.AUTO)
54+
private long id;
55+
private final LocalDate date;
56+
private final Owner owner;
57+
private final Pet pet;
58+
//...
59+
}
60+
public class Pet{
61+
@Id
62+
@GeneratedValue(strategy = GenerationType.AUTO)
63+
private long id;
64+
private final String name;
65+
//...
66+
}
67+
----
68+
69+
[source,java,title="``package software.xdev.example.sdes.repositories``"]
70+
----
71+
public interface OwnerRepository extends CrudRepository<Owner, Long>{}
72+
public interface VetRepository extends CrudRepository<Vet, Long>{}
73+
public interface VisitRepository extends CrudRepository<Visit, Long>{}
74+
public interface PetRepository extends CrudRepository<Pet, Long>{}
75+
----
76+
77+
Note that the ``root`` object is not needed in the new structure.
78+
Since we want to transfer the data in the next step, it is good practice to keep these classes in the same project but in separate packages.
79+
It is recommended that **ids** fields are defined to improve performance.
80+
81+
=== 3. Copy Data
82+
83+
Now it's time to copy the actual data.
84+
For that we need to start up the old EclipseStore storage additionally to the {product-name} storage.
85+
Then we simply iterate over the existing data, repackage it in our new objects and store them through the repositories.
86+
87+
[source,java,title="``package software.xdev.example.sdes.repositories``"]
88+
----
89+
package software.xdev.example;
90+
91+
import org.eclipse.store.storage.embedded.types.EmbeddedStorage;
92+
import org.eclipse.store.storage.embedded.types.EmbeddedStorageManager;
93+
import org.springframework.beans.factory.annotation.Autowired;
94+
import org.springframework.context.event.ContextRefreshedEvent;
95+
import org.springframework.context.event.EventListener;
96+
import org.springframework.stereotype.Service;
97+
import software.xdev.example.sdes.repositories.*;
98+
99+
@Service
100+
public class EclipseStoreDataMigrater
101+
{
102+
OwnerRepository ownerRepository;
103+
VetRepository vetRepository;
104+
VisitRepository visitRepository;
105+
PetRepository petRepository;
106+
107+
@Autowired
108+
public EclipseStoreDataMigrater(OwnerRepository ownerRepository, VetRepository vetRepository, VisitRepository visitRepository, PetRepository petRepository
109+
)
110+
{
111+
this.ownerRepository = ownerRepository;
112+
this.vetRepository = vetRepository;
113+
this.visitRepository = visitRepository;
114+
this.petRepository = petRepository;
115+
}
116+
117+
@EventListener
118+
public void migrateData(final ContextRefreshedEvent event)
119+
{
120+
final software.xdev.example.eclipse.store.Root root = new software.xdev.example.eclipse.store.Root(null, null);
121+
try(final EmbeddedStorageManager storageManager = EmbeddedStorage.start(root))
122+
{
123+
root.owners.forEach(owner -> {
124+
owner.pets.forEach(pet -> this.petRepository.save(new software.xdev.example.sdes.entities.Pet(pet.name)));
125+
//...
126+
});
127+
}
128+
}
129+
}
130+
----
131+
132+
This is very simplified but shows the general strategy to migrate data from EclipseStore to {product-name}.

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
2323

2424
<!-- Should be in sync with org.eclipse.store:integrations-spring-boot3 -->
25-
<org.springframework.boot.version>3.4.1</org.springframework.boot.version>
26-
<org.eclipse.store.version>2.1.0</org.eclipse.store.version>
27-
<org.eclipse.serializer.version>2.1.0</org.eclipse.serializer.version>
28-
<org.eclipse.storage-restservice-springboot.version>2.1.0</org.eclipse.storage-restservice-springboot.version>
25+
<org.springframework.boot.version>3.4.2</org.springframework.boot.version>
26+
<org.eclipse.store.version>2.1.1</org.eclipse.store.version>
27+
<org.eclipse.serializer.version>2.1.1</org.eclipse.serializer.version>
28+
<org.eclipse.storage-restservice-springboot.version>2.1.1</org.eclipse.storage-restservice-springboot.version>
2929
</properties>
3030

3131
<modules>

renovate.json5

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@
1919
"maven"
2020
],
2121
"groupName": "net.sourceforge.pmd"
22+
},
23+
{
24+
"description": "Group org.eclipse.store/serializer",
25+
"matchPackagePatterns": [
26+
"^org.eclipse.store",
27+
"^org.eclipse.serializer"
28+
],
29+
"datasources": [
30+
"maven"
31+
],
32+
"groupName": "org.eclipse.store-serializer"
2233
}
2334
]
2435
}

spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/dual/storage/invoice/PersistenceInvoiceConfiguration.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111
import org.springframework.beans.factory.annotation.Autowired;
1212
import org.springframework.context.annotation.Configuration;
1313

14+
import software.xdev.spring.data.eclipse.store.demo.dual.storage.person.PersistencePersonConfiguration;
1415
import software.xdev.spring.data.eclipse.store.repository.config.EclipseStoreClientConfiguration;
1516
import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories;
1617

1718

1819
/**
19-
* To set this configuration for the package we use the {@link EnableEclipseStoreRepositories#clientConfiguration()}
20-
* ()}. Another example:
20+
* To set this configuration for the package we use the {@link EnableEclipseStoreRepositories#clientConfiguration()}.
21+
* Another example:
2122
* {@link software.xdev.spring.data.eclipse.store.demo.dual.storage.person.PersistencePersonConfiguration}
2223
*/
2324
@Configuration
@@ -49,7 +50,7 @@ public EmbeddedStorageFoundation<?> createEmbeddedStorageFoundation()
4950
final EmbeddedStorageFoundation<?> storageFoundation =
5051
EmbeddedStorage.Foundation(Storage.Configuration(Storage.FileProvider(Path.of(STORAGE_PATH))));
5152
// This is only needed, if a different ClassLoader is used (e.g. when using spring-dev-tools)
52-
storageFoundation.getConnectionFoundation().setClassLoaderProvider(getClassLoaderProvider());
53+
storageFoundation.getConnectionFoundation().setClassLoaderProvider(this.getClassLoaderProvider());
5354
return storageFoundation;
5455
}
5556
}

spring-data-eclipse-store/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@
5151
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
5252

5353
<!-- Should be in sync with org.eclipse.store:integrations-spring-boot3 -->
54-
<org.springframework.boot.version>3.4.1</org.springframework.boot.version>
55-
<org.eclipse.store.version>2.1.0</org.eclipse.store.version>
56-
<org.eclipse.serializer.version>2.1.0</org.eclipse.serializer.version>
54+
<org.springframework.boot.version>3.4.2</org.springframework.boot.version>
55+
<org.eclipse.store.version>2.1.1</org.eclipse.store.version>
56+
<org.eclipse.serializer.version>2.1.1</org.eclipse.serializer.version>
5757
<hibernate-validator.version>8.0.2.Final</hibernate-validator.version>
5858
<jakarta.el-api.version>6.0.1</jakarta.el-api.version>
5959
<expressly.version>6.0.0-M1</expressly.version>
60-
<hibernate-core.version>6.6.4.Final</hibernate-core.version>
60+
<hibernate-core.version>6.6.5.Final</hibernate-core.version>
6161
<micro-migration.version>3.0.1</micro-migration.version>
6262
</properties>
6363

spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EclipseStoreClientConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ protected boolean shouldShutdownStorageOnContextClosed()
185185
LOG.warn("Will shut down storage because Spring Boot DevTools Restarting is active. "
186186
+ "This may cause some unexpected behavior. "
187187
+ "For more information have a look at "
188-
+ "https://spring-eclipsestore.xdev.software/known-issues.html#_spring_developer_tools");
188+
+ "https://spring-eclipsestore.xdev.software/known-issues.html#spring-dev-tools");
189189
}
190190
return enabled;
191191
}

spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/config/EclipseStoreRepositoryConfigurationExtension.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public String getRepositoryFactoryBeanClassName()
8181
* This is surely not the perfect way to get the correct configuration of that context, but it works with multiple
8282
* configurations, with no configuration and with a single configuration.
8383
*/
84+
@SuppressWarnings("NullableProblems")
8485
@Override
8586
public void postProcess(final BeanDefinitionBuilder builder, final AnnotationRepositoryConfigurationSource config)
8687
{

0 commit comments

Comments
 (0)