Skip to content

The annotation based auditing does not work for nested list [DATACMNS-1297] #1739

@spring-projects-issues

Description

@spring-projects-issues

Kazuki Shimizu opened DATACMNS-1297 and commented

The annotation based auditing(supported by DATACMNS-1274) does not work for nested list.
I want to support the auditing feature for a nested list.

class Embedded {
 
	@CreatedDate Instant created;
	@CreatedBy String creator;
	@LastModifiedDate Instant modified;
	@LastModifiedBy String modifier;
}
 
class WithEmbedded {
	Embedded embedded;
	List<Embedded> embeddedList = new ArrayList<>();
}
@Test
public void writesNestedAuditingData() {

	WithEmbedded target = new WithEmbedded();
	target.embedded = new Embedded();
	target.embeddedList.add(new Embedded());
	...
}

Test result is as follow:

writesNestedAuditingData(org.springframework.data.auditing.MappingAuditableBeanWrapperFactoryUnitTests)  Time elapsed: 0.019 sec  <<< ERROR!
java.lang.IllegalArgumentException: Target bean of type java.util.ArrayList is not of type of the persistent entity (org.springframework.data.auditing.MappingAuditableBeanWrapperFactoryUnitTests$Embedded)!
        at org.springframework.data.auditing.MappingAuditableBeanWrapperFactoryUnitTests.lambda$writesNestedAuditingData$5(MappingAuditableBeanWrapperFactoryUnitTests.java:195)
        at org.springframework.data.auditing.MappingAuditableBeanWrapperFactoryUnitTests.writesNestedAuditingData(MappingAuditableBeanWrapperFactoryUnitTests.java:190)

Same issue is occurred on DATAJDBC-204 (spring-projects/spring-data-relational#64)


Affects: 2.1 M2 (Lovelace)

Issue Links:

  • DATACMNS-1438 Annotation based auditing fails for annotation properties underneath collection valued subpath
    ("duplicates")

2 votes, 2 watchers

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions