Skip to content

Commit 1ca2f11

Browse files
Minor fixes for starting storage in an unusual way
1 parent 632f1e3 commit 1ca2f11

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ public synchronized <T> void store(
158158
final Class<T> clazz,
159159
final Iterable<T> entitiesToStore)
160160
{
161+
this.ensureEntitiesInRoot();
161162
final Collection<Object> entitiesAndPossiblyNonEntitiesToStore =
162163
this.collectRootEntitiesToStore(clazz, entitiesToStore);
163164
entitiesAndPossiblyNonEntitiesToStore.addAll(nonEntitiesToStore);
@@ -205,6 +206,7 @@ private <T> Collection<Object> collectRootEntitiesToStore(final Class<T> clazz,
205206

206207
public synchronized <T> void delete(final Class<T> clazz, final T objectToRemove)
207208
{
209+
this.ensureEntitiesInRoot();
208210
final List<IdentitySet<Object>> entityLists =
209211
this.entitySetCollector.getRelatedIdentitySets(clazz);
210212
entityLists.forEach(entityList ->
@@ -239,6 +241,7 @@ public synchronized <T> void deleteAll(final Class<T> clazz)
239241

240242
public synchronized void clearData()
241243
{
244+
this.ensureEntitiesInRoot();
242245
this.root = new Root();
243246
final StorageManager instanceOfstorageManager = this.getInstanceOfStorageManager();
244247
this.initRoot();
@@ -273,6 +276,7 @@ public synchronized void stop()
273276
@SuppressWarnings("unchecked")
274277
public <T> IdSetter<T> ensureIdSetter(final Class<T> domainClass)
275278
{
279+
this.ensureEntitiesInRoot();
276280
return (IdSetter<T>)this.entityClassToIdSetter.computeIfAbsent(
277281
domainClass,
278282
clazz ->

0 commit comments

Comments
 (0)