Add @Instantiator annotation to mark the canonical constructor #5786
Replies: 1 comment 1 reply
-
Oh gawd of course I underestimated this one when we talked. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I propose adding a
@Instantiator
annotation that allows marking the canonical constructor i.e. the constructor which takes in all properties, which should be used for instantiation.As a first step, I would like to support this on embeddables to infer a
EmbeddableInstantiator
from the order of arguments of the constructor. This will require some byte code data flow analysis, but I implemented that in the past and I know it's usually doable. We can consider addingString[] value() default {}
to represent the ordered set of property names for cases when the analysis fails, but let's only do that if absolutely necessary.This would also affect column ordering for embeddables that represent structs, just like records are handled: #5783
Also see https://hibernate.atlassian.net/browse/HHH-15898
Beta Was this translation helpful? Give feedback.
All reactions