Uploaded image for project: 'Spring Data Commons'
  1. Spring Data Commons
  2. DATACMNS-1247

Issue with @DomainEvents with a spring data repository having @cacheable decorated methods

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Waiting for Feedback
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.13.8 (Ingalls SR8), 2.0.2 (Kay SR2)
    • Fix Version/s: None
    • Component/s: None

      Description

      Have any one had issues with using @DomainEvents with a Spring Data repository having @Cacheable decorated methods. It seems the domainEvents object don't get initialized when data comes from cache and hence give a NPE . This happens cause the transient variable not getting initialized when the data is coming from cache.

      public class AbstractAggregateRoot<A extends AbstractAggregateRoot<A>> {
      	private transient final @Transient List<Object> domainEvents = new ArrayList<>();
      

      My caching repository is pretty simple looks like this, just the cache implementation I am using is based on Apache ignite. As a workaround currently I am not using domain events for cacheable methods, but I hope we can resolve this to get over the boilerplate and NPE issues.

        Attachments

          Activity

            People

            Assignee:
            olivergierke Oliver Drotbohm
            Reporter:
            gauravbrills Gaurav Rawat
            Last updater:
            Spring Issues Spring Issues
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: