Skip to content

v1.0.5 #75

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 40 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
6d4deba
Updated EclipseStore version
JohannesRabauer Apr 24, 2024
decf6b6
Lazy Test with LazyManager
JohannesRabauer Apr 24, 2024
a73d413
Added Transaction tests
JohannesRabauer Apr 25, 2024
8410c50
Tests for Transactions
JohannesRabauer Apr 25, 2024
f08fa62
More Transaction Tests
JohannesRabauer Apr 25, 2024
9cd414c
Implemented TransactionManager
JohannesRabauer Apr 25, 2024
5491038
Added Transaction Tests
JohannesRabauer Apr 26, 2024
db103f0
EclipseStoreTransactionManager refined
JohannesRabauer Apr 26, 2024
ab1626c
Merge pull request #70 from xdev-software/master
JohannesRabauer Apr 29, 2024
93bb745
Merge pull request #66 from xdev-software/LazyReferenceManagerIssue
JohannesRabauer Apr 29, 2024
ab2674b
Updated version
JohannesRabauer Apr 30, 2024
93686a1
Merge branch 'develop' into transactions
JohannesRabauer Apr 30, 2024
03847a5
Update org.springframework.boot.version to v3.2.5
xdev-renovate Apr 30, 2024
7431027
implemented TransactionAction
JohannesRabauer Apr 30, 2024
cdb294b
Merge branch 'eclipseStore1.3' into transactions
JohannesRabauer Apr 30, 2024
440a01a
Major restructuring of configuration
JohannesRabauer May 2, 2024
f825471
Overhaul of configuration completed
JohannesRabauer May 2, 2024
a49beec
TransactionManager synchronizing access
JohannesRabauer May 3, 2024
28abf74
Adjusted Lazy for new EclipseStore version
JohannesRabauer May 3, 2024
e1b8c51
First simple working transaction behavior
JohannesRabauer May 3, 2024
23e5726
Added Transaction test
JohannesRabauer May 7, 2024
7d26454
Made FieldAccessibleMaker change private fields and not change it back
JohannesRabauer May 7, 2024
ec1f1ad
Added Transaction concurrency tests
JohannesRabauer May 7, 2024
6756346
Added Lazy to the EclipseStoreDataImporterComponent
JohannesRabauer May 7, 2024
7293d22
Update dependency com.mycila:license-maven-plugin to v4.4
xdev-renovate May 8, 2024
a40c860
Updated EclipseStore version
JohannesRabauer May 8, 2024
9d7f684
Added transactions to the complex demo
JohannesRabauer May 8, 2024
0fa0cd3
Updated README for new version
JohannesRabauer May 8, 2024
596d7b4
Fixed for Checkstyle
JohannesRabauer May 8, 2024
4ee78f0
Added programmatic Transaction demo
JohannesRabauer May 8, 2024
44cd9a9
Docs for transactions
JohannesRabauer May 8, 2024
6714aaf
Disabled flaky test
JohannesRabauer May 8, 2024
5c642d4
Update dependency org.apache.maven.plugins:maven-site-plugin to v4.0.…
xdev-renovate May 9, 2024
4f0f493
Merge pull request #73 from xdev-software/transactions
JohannesRabauer May 10, 2024
ab22965
Merge pull request #74 from xdev-software/renovate/org.apache.maven.p…
JohannesRabauer May 10, 2024
55b7bf8
Merge pull request #72 from xdev-software/renovate/com.mycila-license…
JohannesRabauer May 10, 2024
56460b7
Merge branch 'develop' into renovate/org.springframework.boot.version
JohannesRabauer May 10, 2024
ba22064
Updated README Spring version
JohannesRabauer May 10, 2024
d8c77d0
Merge pull request #58 from xdev-software/renovate/org.springframewor…
JohannesRabauer May 10, 2024
15bf717
Rollback of version Update com.mycila:license-maven-plugin
JohannesRabauer May 10, 2024
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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ instructions** are in the documentation](https://xdev-software.github.io/spring-
| Spring-Data-Eclipse-Store | Java | Spring Data | EclipseStore |
|---------------------------|--------|-------------|--------------|
| ``<= 1.0.2`` | ``17`` | ``3.2.2`` | ``1.1.0`` |
| ``>= 1.0.3`` | ``17`` | ``3.2.3`` | ``1.2.0`` |
| ``1.0.3/1.0.4`` | ``17`` | ``3.2.3`` | ``1.2.0`` |
| ``>= 1.0.5`` | ``17`` | ``3.2.5`` | ``1.3.2`` |

## Demo

Expand Down
6 changes: 3 additions & 3 deletions docs/antora.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: ROOT
title: Spring-Data-Eclipse-Store
version: master
display_version: '1.0.3'
display_version: '1.0.5'
start_page: index.adoc
nav:
- modules/ROOT/nav.adoc
asciidoc:
attributes:
product-name: 'Spring-Data-Eclipse-Store'
display-version: '1.0.3'
maven-version: '1.0.3'
display-version: '1.0.5'
maven-version: '1.0.5'
page-editable: false
page-out-of-support: false
1 change: 1 addition & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
* xref:configuration.adoc[Configuration]
* xref:working-copies.adoc[Working Copies]
* xref:lazies.adoc[Lazy References]
* xref:transactions.adoc[Transactions]
* xref:migration.adoc[Migration]
* xref:known-issues.adoc[Known issues]
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/configuration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import org.eclipse.store.storage.embedded.types.EmbeddedStorageFoundation;
import org.eclipse.store.storage.types.Storage;
...
@Configuration
@EnableEclipseStoreRepositories(clientConfigurationClass = DemoConfiguration.class)
@EnableEclipseStoreRepositories
public class DemoConfiguration extends EclipseStoreClientConfiguration
{
@Override
Expand Down
12 changes: 9 additions & 3 deletions docs/modules/ROOT/pages/installation.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ Also see the https://github.com/xdev-software/spring-data-eclipse-store/releases

After adding the library in your dependencies, using it is as easy as adding the ``@EnableEclipseStoreRepositories`` annotation to your ``@SpringBootApplication`` annotation.

[NOTE]
====
Since the library is using reflection to copy data, the following JVM-Arguments may have to be set.
=== Merge behavior

To merge data of the xref:working-copies.adoc[working copy] into the original object graph, the library is using reflection.
Therefore, the following *JVM-Arguments* may have to be set:

[source,title="JVM Arguments"]
----
Expand All @@ -34,6 +35,11 @@ Since the library is using reflection to copy data, the following JVM-Arguments
--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.time=ALL-UNNAMED
----

[NOTE]
====
To access ``private`` variables, the library uses reflection and sets the access level to ``public`` (see https://github.com/xdev-software/spring-data-eclipse-store/blob/develop/spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/access/modifier/FieldAccessibleMaker.java[FieldAccessibleMaker]).
For performance reasons, *this change stays permanent* during runtime.
====

== Demo
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/lazies.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class Owner extends Person
//...
----

== Internas
== Internals

SpringDataEclipseStoreLazies work as a proxy for the EclipseStore-Lazies.
As far as EclipseStore is concerned, a SpringDataEclipseStoreLazy-Object is a normal Java object that contains a Lazy-Reference.
Expand Down
62 changes: 62 additions & 0 deletions docs/modules/ROOT/pages/transactions.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
= Transactions

[quote,https://docs.spring.io/spring-framework/reference/data-access/transaction.html[spring - Transaction Management]]

____
Comprehensive transaction support is among the *most compelling reasons* to use the Spring Framework.
____

That's why we implemented *Spring Transactions*.

Just like Spring JPA you can use https://docs.spring.io/spring-framework/reference/data-access/transaction/declarative.html[declarative] or https://docs.spring.io/spring-framework/reference/data-access/transaction/programmatic.html[programmatic] transaction management.

[source,java,title="https://github.com/xdev-software/spring-data-eclipse-store/blob/develop/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex/VetService.java[Declarative example from complex demo]"]
----
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
//...
@Service
@Transactional
public class VetService
{
//...
public void saveNewEntries()
{
final Vet vet = this.createVet();
this.vetRepository.save(vet);
}
//...
----

[source,java,title="https://github.com/xdev-software/spring-data-eclipse-store/blob/develop/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex/OwnerService.java[Programmatic example from complex demo]"]
----
import org.springframework.stereotype.Service;
import org.springframework.transaction.PlatformTransactionManager;
//...
@Service
public class OwnerService
{
private final PlatformTransactionManager transactionManager;

@Autowired
public OwnerService(
final OwnerRepository ownerRepository,
final PlatformTransactionManager transactionManager)
{
this.ownerRepository = ownerRepository;
this.transactionManager = transactionManager;
}
//...
public void deleteAll()
{
new TransactionTemplate(this.transactionManager).execute(
status ->
{
this.ownerRepository.deleteAll();
return null;
});
}
//...
----

CAUTION: If you are using transaction, you need to define a ``Bean`` for ``PlatformTransactionManager``! This is easiest achieved by extending the ``EclipseStoreClientConfiguration``. See https://github.com/xdev-software/spring-data-eclipse-store/blob/develop/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex/ComplexConfiguration.java[the complex demo].
2 changes: 1 addition & 1 deletion spring-data-eclipse-store-benchmark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<org.springframework.boot.version>3.2.3</org.springframework.boot.version>
<org.springframework.boot.version>3.2.5</org.springframework.boot.version>
<jmh.version>1.37</jmh.version>
</properties>

Expand Down
2 changes: 1 addition & 1 deletion spring-data-eclipse-store-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<mainClass>software.xdev.spring.data.eclipse.store.demo.complex.ComplexDemoApplication</mainClass>

<org.springframework.boot.version>3.2.3</org.springframework.boot.version>
<org.springframework.boot.version>3.2.5</org.springframework.boot.version>
</properties>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package software.xdev.spring.data.eclipse.store.demo.complex;

import org.eclipse.store.integrations.spring.boot.types.configuration.EclipseStoreProperties;
import org.eclipse.store.integrations.spring.boot.types.factories.EmbeddedStorageFoundationFactory;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.transaction.TransactionManagerCustomizers;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.PlatformTransactionManager;

import software.xdev.spring.data.eclipse.store.repository.config.EclipseStoreClientConfiguration;
import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories;


@Configuration
@EnableEclipseStoreRepositories
public class ComplexConfiguration extends EclipseStoreClientConfiguration
{
@Autowired
public ComplexConfiguration(
final EclipseStoreProperties defaultEclipseStoreProperties,
final EmbeddedStorageFoundationFactory defaultEclipseStoreProvider
)
{
super(defaultEclipseStoreProperties, defaultEclipseStoreProvider);
}

/**
* Overriding {@link #transactionManager(ObjectProvider)} only to add the {@link Bean}-Annotation.
*/
@Bean
@Override
public PlatformTransactionManager transactionManager(
final ObjectProvider<TransactionManagerCustomizers> transactionManagerCustomizers
)
{
return super.transactionManager(transactionManagerCustomizers);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,27 @@

package software.xdev.spring.data.eclipse.store.demo.complex;

import java.time.LocalDate;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.data.domain.Pageable;

import software.xdev.spring.data.eclipse.store.demo.complex.owner.Owner;
import software.xdev.spring.data.eclipse.store.demo.complex.owner.OwnerRepository;
import software.xdev.spring.data.eclipse.store.demo.complex.owner.Pet;
import software.xdev.spring.data.eclipse.store.demo.complex.owner.PetType;
import software.xdev.spring.data.eclipse.store.demo.complex.owner.Visit;
import software.xdev.spring.data.eclipse.store.demo.complex.vet.Specialty;
import software.xdev.spring.data.eclipse.store.demo.complex.vet.Vet;
import software.xdev.spring.data.eclipse.store.demo.complex.vet.VetRepository;
import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories;


@SpringBootApplication
@EnableEclipseStoreRepositories
public class ComplexDemoApplication implements CommandLineRunner
{
private static final Logger LOG = LoggerFactory.getLogger(ComplexDemoApplication.class);
private final OwnerRepository ownerRepository;
private final VetRepository vetRepository;
private final OwnerService ownerService;
private final VetService vetService;

public ComplexDemoApplication(final OwnerRepository ownerRepository, final VetRepository vetRepository)
@Autowired
public ComplexDemoApplication(
final OwnerService ownerService,
final VetService vetService
)
{
this.ownerRepository = ownerRepository;
this.vetRepository = vetRepository;
this.ownerService = ownerService;
this.vetService = vetService;
}

public static void main(final String[] args)
Expand All @@ -60,94 +48,31 @@ public static void main(final String[] args)
@Override
public void run(final String... args)
{
LOG.info("----Vets-BeforeDeleteAll----");
this.vetRepository.findAll().forEach(i -> LOG.info(i.toString()));
this.vetRepository.deleteAll();

LOG.info("----Vets-AfterDeleteAll----");
this.vetRepository.findAll().forEach(i -> LOG.info(i.toString()));

final Vet vet = createVet();
this.vetRepository.save(vet);

LOG.info("----Vets-AfterSave----");
this.vetRepository.findAll().forEach(i -> LOG.info(i.toString()));

LOG.info("----Owner-BeforeDeleteAll----");
this.ownerRepository.findAll(Pageable.unpaged()).forEach(i -> LOG.info(i.toString()));
this.ownerRepository.deleteAll();

LOG.info("----Owner-AfterDeleteAll----");
this.ownerRepository.findAll(Pageable.unpaged()).forEach(i -> LOG.info(i.toString()));

final Owner owner = createOwner();
this.ownerRepository.save(owner);

LOG.info("----Owner-AfterSave----");
this.ownerRepository.findAll(Pageable.unpaged()).forEach(i -> LOG.info(i.toString()));

final Visit visit = createVisit();
owner.addVisit("Peter", visit);
this.ownerRepository.save(owner);

LOG.info("----Owner-AfterVisit----");
this.ownerRepository
.findByLastName("Nicks", Pageable.unpaged())
.forEach(i ->
{
LOG.info(i.toString());
i.getPets().forEach(p -> {
LOG.info(p.toString());
p.getVisits().forEach(v -> LOG.info(v.toString()));
}
);
}
);

LOG.info("----Owner-Lazy Pet loading----");
this.ownerRepository.findAll().forEach(
o -> o.getPets().forEach(
pet -> LOG.info(String.format(
"Pet %s has owner %s %s",
pet.getName(),
o.getFirstName(),
o.getLastName()))
)
);
}

private static Visit createVisit()
{
final Visit visit = new Visit();
visit.setDate(LocalDate.now());
visit.setDescription("Peter got his first parvovirus vaccine");
return visit;
this.vetCalls();
this.ownerCalls();
}

private static Vet createVet()
/**
* Some calls are transactional (delete and create) and some are not (log).
*/
private void ownerCalls()
{
final Vet vet = new Vet();
vet.setFirstName("Mick");
vet.setLastName("Fleetwood");
final Specialty specialty = new Specialty();
specialty.setName("Vaccination");
vet.addSpecialty(specialty);
return vet;
this.ownerService.logOwners();
this.ownerService.deleteAll();
this.ownerService.logOwners();
this.ownerService.createNewOwnerAndVisit();
this.ownerService.logOwnersAndVisits();
}

@SuppressWarnings("checkstyle:MagicNumber")
private static Owner createOwner()
/**
* Each of these calls are one transaction.
*/
private void vetCalls()
{
final Owner owner = new Owner();
owner.setFirstName("Stevie");
owner.setLastName("Nicks");
final Pet pet = new Pet();
pet.setBirthDate(LocalDate.now().minusWeeks(6));
pet.setName("Peter");
final PetType petType = new PetType();
petType.setName("Dog");
pet.setType(petType);
owner.addPet(pet);
return owner;
this.vetService.logVetEntries();
this.vetService.deleteAll();
this.vetService.logVetEntries();
this.vetService.saveNewEntries();
this.vetService.logVetEntries();
}
}
Loading