Currently io.jmix.gradle.TransientAnnotationEnhancingStep adds only jakarta.persistence.Transient annotation.
For some DB intergrations it is needed to add different annotations in order to ignore some attributes from been precessed, e.g.: when working with mongo using spring-boot-starter-data-mongobd, it is needed to add org.springframework.data.annotation.Transient annotation. Without it, mapping our DTO to Mongo document results in StackOverflowException because of _jmixEntityEntry field, which refers on source (entity itself) which refers on _jmixEntityEntry which refers on source (entity itself) which refers on... boom.
Run docker compose up from project's docker directory
Start the app
Try to create a new Product
AR:
Caused by: java.lang.StackOverflowError: null
at java.base/java.util.HashMap.get(HashMap.java:556) ~[na:na]
at org.springframework.data.mapping.model.ClassGeneratingPropertyAccessorFactory.getPropertyAccessor(ClassGeneratingPropertyAccessorFactory.java:87) ~[spring-data-commons-2.7.10.jar:2.7.10]
at org.springframework.data.mapping.model.InstantiationAwarePropertyAccessorFactory.lambda$getPropertyAccessor$0(InstantiationAwarePropertyAccessorFactory.java:46) ~[spring-data-commons-2.7.10.jar:2.7.10]
at org.springframework.data.mapping.model.InstantiationAwarePropertyAccessor.getProperty(InstantiationAwarePropertyAccessor.java:157) ~[spring-data-commons-2.7.10.jar:2.7.10]
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.writeProperties(MappingMongoConverter.java:882) ~[spring-data-mongodb-3.4.10.jar:3.4.10]
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.writeInternal(MappingMongoConverter.java:864) ~[spring-data-mongodb-3.4.10.jar:3.4.10]
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.writePropertyInternal(MappingMongoConverter.java:998) ~[spring-data-mongodb-3.4.10.jar:3.4.10]
Currently
io.jmix.gradle.TransientAnnotationEnhancingStep
adds onlyjakarta.persistence.Transient
annotation.For some DB intergrations it is needed to add different annotations in order to ignore some attributes from been precessed, e.g.: when working with mongo using
spring-boot-starter-data-mongobd
, it is needed to addorg.springframework.data.annotation.Transient
annotation. Without it, mapping our DTO to Mongo document results inStackOverflowException
because of_jmixEntityEntry
field, which refers on source (entity itself) which refers on_jmixEntityEntry
which refers on source (entity itself) which refers on... boom.mongodb-sample.zip
Case:
docker compose up
from project'sdocker
directoryAR: