Looks like EntityImportExportImpl.validateEntities doesn't check if metaProperty isMethodBased or something else.
Steps To Reproduce
@JmixEntity
@Table(name = "JT_TEST_ENTITY")
@Entity(name = "jt_TestEntity")
open class TestEntity {
@JmixGeneratedValue
@Column(name = "ID", nullable = false)
@Id
var id: UUID? = null
@NotNull
@InstanceName
@Column(name = "NAME")
var name: String? = null
@NotNull
@Column(name = "BOOL_VAR", nullable = false)
var boolVar: Boolean? = false
@Transient
@JmixProperty
var testDto: TestDto? = null
@Transient
@JmixProperty
var testDto2: TestDto? = null
@JmixProperty
@DependsOnProperties("boolVar")
fun getTestDtoForGrid(): TestDto? {
return if (boolVar == true) {
testDto
} else {
testDto2
}
}
@PostConstruct
fun postConstruct(dataManager: DataManager) {
testDto = dataManager.create(TestDto::class.java)
testDto2 = dataManager.create(TestDto::class.java)
}
}
Current Behavior
java.lang.RuntimeException: Property not found: testDtoForGrid
at io.jmix.core.MetadataTools.isAnnotationPresent(MetadataTools.java:553) ~[jmix-core-2.3.4.jar:na]
at io.jmix.core.MetadataTools.isAnnotationPresent(MetadataTools.java:527) ~[jmix-core-2.3.4.jar:na]
at io.jmix.core.impl.importexport.EntityImportExportImpl.validateEntities(EntityImportExportImpl.java:346) ~[jmix-core-2.3.4.jar:na]
at io.jmix.core.impl.importexport.EntityImportExportImpl.importEntities(EntityImportExportImpl.java:271) ~[jmix-core-2.3.4.jar:na]
at io.jmix.core.impl.importexport.EntityImportExportImpl.importEntities(EntityImportExportImpl.java:220) ~[jmix-core-2.3.4.jar:na]
at io.jmix.core.impl.importexport.EntityImportExportImpl.importEntities(EntityImportExportImpl.java:215) ~[jmix-core-2.3.4.jar:na]
at io.jmix.rest.impl.service.EntitiesControllerManager.createEntityFromJson(EntitiesControllerManager.java:550) ~[jmix-rest-2.3.4.jar:na]
at io.jmix.rest.impl.service.EntitiesControllerManager.createResponseInfoEntity(EntitiesControllerManager.java:440) ~[jmix-rest-2.3.4.jar:na]
at io.jmix.rest.impl.service.EntitiesControllerManager.createEntity(EntitiesControllerManager.java:419) ~[jmix-rest-2.3.4.jar:na]
at io.jmix.rest.impl.controller.EntitiesController.createEntity(EntitiesController.java:128) ~[jmix-rest-2.3.4.jar:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:255) ~[spring-web-6.1.13.jar:6.1.13]
...
Environment
Jmix version: 2.3.4
Bug Description
Entity creation via rest causing an error
forum link
Looks like EntityImportExportImpl.validateEntities doesn't check if metaProperty isMethodBased or something else.
Steps To Reproduce
Current Behavior
Expected Behavior
Entity is created
Sample Project
jmix-test.zip