CompositeUserType #3960
Replies: 4 comments 4 replies
-
What do you think about the following?
This way, a user could define the composite type in terms of java types and make use of existing java and jdbc type descriptors. |
Beta Was this translation helpful? Give feedback.
-
See https://hibernate.zulipchat.com/#narrow/stream/132094-hibernate-orm-dev/topic/CompositeUserType for a continuing discussion of this |
Beta Was this translation helpful? Give feedback.
-
A few thoughts after working with this some more... I think the first thing to consider is whether we want to support these cases via a dedicated contract anymore (aka an update of We've discussed the annotation-based approach already a bit. Mainly this resolves around the ability to provide (1) an instantiator and (2) a "mapping". I started a preliminary prototype of such a "mapping" akin to I'm not against continuing support for |
Beta Was this translation helpful? Give feedback.
-
As we discussed during an audio chat, we will go with the "embeddable projection" style of mapping. The implementation for this will be part of #4824 |
Beta Was this translation helpful? Give feedback.
-
Similar to
UserType
,CompositeUserType
contract will have to change.The intention for
CompositeUserType
ought to be cases which do not fit into the JPA "embeddable" paradigm, which generally means types that need constructor injection. Conceptually it would fit between a basic type and an embeddable type - a value type mapping to multiple columns.In the broader sense, this is a case where we want to provide a custom
org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy
, especially itsEmbeddableRepresentationStrategy#instantiator
. This would also mean changes toInstantiator
(and a split from theInstantiator
associated with aEntityRepresentationStrategy
) to be have access to the composite valuesShould such a thing be implicitly considered immutable?
This would be awesome:
which would be roughly equivalent (depending on the exact 2 impls ofc) :
Spitball:
Beta Was this translation helpful? Give feedback.
All reactions