Skip to content

v2.5.1 #229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4a380b2
Update net.sourceforge.pmd to v7.9.0
xdev-renovate Dec 28, 2024
5c0db24
Update dependency com.puppycrawl.tools:checkstyle to v10.21.1
xdev-renovate Dec 29, 2024
0150185
Merge pull request #221 from xdev-software/master
JohannesRabauer Jan 8, 2025
56f69c7
Added documentation for migration-from-eclipse-store
JohannesRabauer Jan 8, 2025
ed0856a
Update known-issues.adoc
JohannesRabauer Jan 8, 2025
d4863a6
Update migration-from-eclipse-store.adoc
JohannesRabauer Jan 8, 2025
ecda6dd
Added some customIdTests
JohannesRabauer Jan 10, 2025
b5612bf
Added lazyWithComplexId tests
JohannesRabauer Jan 10, 2025
de7559e
Fix checkstyle
JohannesRabauer Jan 10, 2025
87dea0f
Merge pull request #127 from xdev-software/renovate/com.puppycrawl.to…
AB-xdev Jan 13, 2025
22775a4
Merge pull request #126 from xdev-software/renovate/net.sourceforge.pmd
AB-xdev Jan 13, 2025
69b028e
Update README.md
JohannesRabauer Jan 15, 2025
5650f0c
Merge branch 'develop' into update-from-template-merged
xdev-gh-bot Jan 20, 2025
dc5f180
[Renovate] Group Eclipse Store
AB-xdev Jan 22, 2025
45908ef
Update org.eclipse.store-serializer to v2.1.1
xdev-renovate Jan 22, 2025
9e2fbee
Merge pull request #227 from xdev-software/renovate/org.eclipse.store…
AB-xdev Jan 22, 2025
e614112
Fix documentation link
AB-xdev Jan 23, 2025
045bb2b
Update dependency org.hibernate.orm:hibernate-core to v6.6.5.Final
xdev-renovate Jan 24, 2025
bf9e977
Update org.springframework.boot.version to v3.4.2
xdev-renovate Jan 24, 2025
10bff63
Simplified configuration injection in ``EclipseStoreRepositoryFactory…
JohannesRabauer Jan 24, 2025
2485dac
Merge branch 'develop' of https://github.com/xdev-software/spring-dat…
JohannesRabauer Jan 24, 2025
a1d946d
Updated README and CHANGELOG
JohannesRabauer Jan 24, 2025
0397853
Merge pull request #225 from xdev-software/renovate/hibernate-core.ve…
JohannesRabauer Jan 24, 2025
3d18daf
Merge pull request #228 from xdev-software/renovate/org.springframewo…
JohannesRabauer Jan 24, 2025
ab02289
Updated README and CHANGELOG
JohannesRabauer Jan 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 2.5.1

* Simplified configuration injection in ``EclipseStoreRepositoryFactoryBean``.
* Updated EclipseStore to v2.1.1
* Updated org.springframework.boot.version to v3.4.2

# 2.5.0

* Updated org.springframework.boot.version to v3.4.1
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ instructions** are in the documentation](https://xdev-software.github.io/spring-
| ``2.2.0-2.3.1`` | ``17`` | ``3.3.4`` | ``1.4.0`` |
| ``2.4.0`` | ``17`` | ``3.4.0`` | ``2.0.0`` |
| ``2.4.1`` | ``17`` | ``3.4.0`` | ``2.1.0`` |
| ``>= 2.5.0`` | ``17`` | ``3.4.1`` | ``2.1.0`` |
| ``2.5.0`` | ``17`` | ``3.4.1`` | ``2.1.0`` |
| ``>= 2.5.1`` | ``17`` | ``3.4.2`` | ``2.1.1`` |

## Demo

Expand All @@ -86,6 +87,12 @@ the [demos](./spring-data-eclipse-store-demo):
If you need support as soon as possible, and you can't wait for any pull request, feel free to
use [our support](https://xdev.software/en/services/support).

## Additional Information

* [Recording of an introduction talk at JUG Bangalore](https://www.youtube.com/watch?v=OlGZ2Hr0FdA)
* [Recording of an introduction talk at JCON 2024](https://youtu.be/-WBbKUGeYBw?si=utZRlY9b2twQLxW8)
* 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/)

## Contributing
See the [contributing guide](./CONTRIBUTING.md) for detailed instructions on how to get started with our project.

Expand Down
1 change: 1 addition & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
** xref:features/rest-api.adoc[REST Interface]
** xref:features/validation-constraints.adoc[Validation Constraints]
* xref:migration-from-jpa.adoc[Migration from JPA]
* xref:migration-from-eclipse-store.adoc[Migration from EclipseStore]
* xref:known-issues.adoc[Known issues]
9 changes: 3 additions & 6 deletions docs/modules/ROOT/pages/known-issues.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ That consists of https://docs.eclipsestore.io/manual/storage/legacy-type-mapping

=== Values

There is a library to version your data in the store called https://github.com/xdev-software/micro-migration[XDEV MicroMigration].
This helps you keep your data up to date regardless of the current version.

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*.
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].

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

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

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

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

What Happens When an Article is Deleted?
=== What Happens When an Article is Deleted?

1. In an *SQL Database*: +
Attempting to delete an article that is still referenced (e.g., by an order) would typically result in an exception. +
Expand Down
132 changes: 132 additions & 0 deletions docs/modules/ROOT/pages/migration-from-eclipse-store.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
= Migration from EclipseStore

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.

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.

Next, the data must be transferred to the Spring-Data-Eclipse-Store storage.
To facilitate this, both EclipseStore and {product-name} must run within the same JVM (Java Virtual Machine).
This configuration enables the developer to operate both systems simultaneously and transfer data by making simple ``save`` calls to the respective repositories.

== Example

=== 0. Status Quo

Let's say that this is the current state of the code:

[source,java,title="``package software.xdev.example.eclipse.store``"]
----
public record Root(List<Owner> owners, List<Vet> vets){}
public record Owner(String name, List<Pet> pets, List<Visit> visits){}
public record Pet(String name){}
public record Vet(String name, List<Owner> clients){}
public record Visit(LocalDate date, Owner owner, Pet pet){}
----

In this case ``Root`` is the root-object of EclipseStore.

=== 1. Building Repositories

Now entities with its corresponding repositories must be created in the same project:

[source,java,title="``package software.xdev.example.sdes.enitities``"]
----
public class Owner{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private final String name;
private final List<Pet> pets;
private final List<Visit> visits;
//...
}
public class Vet{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private final String name;
private final List<Owner> clients;
//...
}
public class Visit{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private final LocalDate date;
private final Owner owner;
private final Pet pet;
//...
}
public class Pet{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private final String name;
//...
}
----

[source,java,title="``package software.xdev.example.sdes.repositories``"]
----
public interface OwnerRepository extends CrudRepository<Owner, Long>{}
public interface VetRepository extends CrudRepository<Vet, Long>{}
public interface VisitRepository extends CrudRepository<Visit, Long>{}
public interface PetRepository extends CrudRepository<Pet, Long>{}
----

Note that the ``root`` object is not needed in the new structure.
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.
It is recommended that **ids** fields are defined to improve performance.

=== 3. Copy Data

Now it's time to copy the actual data.
For that we need to start up the old EclipseStore storage additionally to the {product-name} storage.
Then we simply iterate over the existing data, repackage it in our new objects and store them through the repositories.

[source,java,title="``package software.xdev.example.sdes.repositories``"]
----
package software.xdev.example;

import org.eclipse.store.storage.embedded.types.EmbeddedStorage;
import org.eclipse.store.storage.embedded.types.EmbeddedStorageManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;
import software.xdev.example.sdes.repositories.*;

@Service
public class EclipseStoreDataMigrater
{
OwnerRepository ownerRepository;
VetRepository vetRepository;
VisitRepository visitRepository;
PetRepository petRepository;

@Autowired
public EclipseStoreDataMigrater(OwnerRepository ownerRepository, VetRepository vetRepository, VisitRepository visitRepository, PetRepository petRepository
)
{
this.ownerRepository = ownerRepository;
this.vetRepository = vetRepository;
this.visitRepository = visitRepository;
this.petRepository = petRepository;
}

@EventListener
public void migrateData(final ContextRefreshedEvent event)
{
final software.xdev.example.eclipse.store.Root root = new software.xdev.example.eclipse.store.Root(null, null);
try(final EmbeddedStorageManager storageManager = EmbeddedStorage.start(root))
{
root.owners.forEach(owner -> {
owner.pets.forEach(pet -> this.petRepository.save(new software.xdev.example.sdes.entities.Pet(pet.name)));
//...
});
}
}
}
----

This is very simplified but shows the general strategy to migrate data from EclipseStore to {product-name}.
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<!-- Should be in sync with org.eclipse.store:integrations-spring-boot3 -->
<org.springframework.boot.version>3.4.1</org.springframework.boot.version>
<org.eclipse.store.version>2.1.0</org.eclipse.store.version>
<org.eclipse.serializer.version>2.1.0</org.eclipse.serializer.version>
<org.eclipse.storage-restservice-springboot.version>2.1.0</org.eclipse.storage-restservice-springboot.version>
<org.springframework.boot.version>3.4.2</org.springframework.boot.version>
<org.eclipse.store.version>2.1.1</org.eclipse.store.version>
<org.eclipse.serializer.version>2.1.1</org.eclipse.serializer.version>
<org.eclipse.storage-restservice-springboot.version>2.1.1</org.eclipse.storage-restservice-springboot.version>
</properties>

<modules>
Expand Down
11 changes: 11 additions & 0 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@
"maven"
],
"groupName": "net.sourceforge.pmd"
},
{
"description": "Group org.eclipse.store/serializer",
"matchPackagePatterns": [
"^org.eclipse.store",
"^org.eclipse.serializer"
],
"datasources": [
"maven"
],
"groupName": "org.eclipse.store-serializer"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

import software.xdev.spring.data.eclipse.store.demo.dual.storage.person.PersistencePersonConfiguration;
import software.xdev.spring.data.eclipse.store.repository.config.EclipseStoreClientConfiguration;
import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories;


/**
* To set this configuration for the package we use the {@link EnableEclipseStoreRepositories#clientConfiguration()}
* ()}. Another example:
* To set this configuration for the package we use the {@link EnableEclipseStoreRepositories#clientConfiguration()}.
* Another example:
* {@link software.xdev.spring.data.eclipse.store.demo.dual.storage.person.PersistencePersonConfiguration}
*/
@Configuration
Expand Down Expand Up @@ -49,7 +50,7 @@ public EmbeddedStorageFoundation<?> createEmbeddedStorageFoundation()
final EmbeddedStorageFoundation<?> storageFoundation =
EmbeddedStorage.Foundation(Storage.Configuration(Storage.FileProvider(Path.of(STORAGE_PATH))));
// This is only needed, if a different ClassLoader is used (e.g. when using spring-dev-tools)
storageFoundation.getConnectionFoundation().setClassLoaderProvider(getClassLoaderProvider());
storageFoundation.getConnectionFoundation().setClassLoaderProvider(this.getClassLoaderProvider());
return storageFoundation;
}
}
8 changes: 4 additions & 4 deletions spring-data-eclipse-store/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<!-- Should be in sync with org.eclipse.store:integrations-spring-boot3 -->
<org.springframework.boot.version>3.4.1</org.springframework.boot.version>
<org.eclipse.store.version>2.1.0</org.eclipse.store.version>
<org.eclipse.serializer.version>2.1.0</org.eclipse.serializer.version>
<org.springframework.boot.version>3.4.2</org.springframework.boot.version>
<org.eclipse.store.version>2.1.1</org.eclipse.store.version>
<org.eclipse.serializer.version>2.1.1</org.eclipse.serializer.version>
<hibernate-validator.version>8.0.2.Final</hibernate-validator.version>
<jakarta.el-api.version>6.0.1</jakarta.el-api.version>
<expressly.version>6.0.0-M1</expressly.version>
<hibernate-core.version>6.6.4.Final</hibernate-core.version>
<hibernate-core.version>6.6.5.Final</hibernate-core.version>
<micro-migration.version>3.0.1</micro-migration.version>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ protected boolean shouldShutdownStorageOnContextClosed()
LOG.warn("Will shut down storage because Spring Boot DevTools Restarting is active. "
+ "This may cause some unexpected behavior. "
+ "For more information have a look at "
+ "https://spring-eclipsestore.xdev.software/known-issues.html#_spring_developer_tools");
+ "https://spring-eclipsestore.xdev.software/known-issues.html#spring-dev-tools");
}
return enabled;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public String getRepositoryFactoryBeanClassName()
* This is surely not the perfect way to get the correct configuration of that context, but it works with multiple
* configurations, with no configuration and with a single configuration.
*/
@SuppressWarnings("NullableProblems")
@Override
public void postProcess(final BeanDefinitionBuilder builder, final AnnotationRepositoryConfigurationSource config)
{
Expand Down
Loading
Loading