Add @Transient properties to PersistentEntity and use value defaulting for transient constructor properties#2985
Add @Transient properties to PersistentEntity and use value defaulting for transient constructor properties#2985
@Transient properties to PersistentEntity and use value defaulting for transient constructor properties#2985Conversation
We now ignore transient properties used in constructors. Regular transient properties default to the Java default values (null for object types, 0 for numeric primitives and so on). Using transient properties allows leveraging Kotlin's defaulting mechanism to infer default values. Record components can also be annotated with the Transient annotation to allow record construction. While this can be useful, we recommend using the Value annotation to use SpEL expressions to determine a useful value.
Add missing Override annotations, consistently use literal tags for boolean values.
6af7659 to
df6ca3d
Compare
|
Do we really need One other thing we have to double-check is the expectations that client code using |
We never provided transient properties to callbacks via Likely we don't need to expose
public void treatsTransientAsNotExisting() {
assertThat(getProperty(ClassWithReadOnlyProperties.class, "transientProperty")).isNull();
} |
646e077 to
6ac5cf8
Compare
We now maintain
@Transientmetadata in the mapping model to determine whether a transient property has been used in a Kotlin Data class, Record or plain Java class.Entity instantiation populates properties with default values (
nullfor object types, or primitive default values) so that Kotlin data classes can use defaulting.Closes #1432
Closes #2942