INT-3346: Add @Id to CMDbMS.MessageDocument
JIRA: https://jira.spring.io/browse/INT-3346 An `@Id` field is required when MongoDB auditing is enabled in the ApplicationContext. This change does not make the document Auditable, it just prevents an exception being thrown when auditing is enabled.
This commit is contained in:
committed by
Gary Russell
parent
66a23a2835
commit
39a7fb3adf
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013 the original author or authors.
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -34,6 +34,7 @@ import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.core.convert.converter.GenericConverter;
|
||||
import org.springframework.core.serializer.support.DeserializingConverter;
|
||||
import org.springframework.core.serializer.support.SerializingConverter;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.mongodb.MongoDbFactory;
|
||||
import org.springframework.data.mongodb.core.IndexOperations;
|
||||
@@ -356,6 +357,14 @@ public class ConfigurableMongoDbMessageStore extends AbstractMessageGroupStore
|
||||
*/
|
||||
private static class MessageDocument {
|
||||
|
||||
/*
|
||||
* Needed as a persistence property to suppress 'Cannot determine IsNewStrategy' MappingException
|
||||
* when the application context is configured with auditing. The document is not
|
||||
* currently Auditable.
|
||||
*/
|
||||
@Id
|
||||
private String _id;
|
||||
|
||||
private final Message<?> message;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
|
||||
@@ -81,7 +81,7 @@ public class ConfigurableMongoDbMessageGroupStoreTests extends AbstractMongoDbMe
|
||||
TestGateway gateway = context.getBean(TestGateway.class);
|
||||
String result = gateway.service("foo");
|
||||
assertEquals("FOO", result);
|
||||
|
||||
context.close();
|
||||
}
|
||||
|
||||
public static interface TestGateway {
|
||||
|
||||
Reference in New Issue
Block a user