Earlier determination of nature of @Type, etc #4207
sebersole
started this conversation in
Design Proposals
Replies: 1 comment 4 replies
-
I think we can get rid of these annotations. See my comment for details #3960 (reply in thread) |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For background, this is growing from a discussion about the best way to handle
CompositeUserType
in 6. For the background discussions see -Currently, Hibernate's
@Type
and `@TypeDef`` annotations are String-based in terms of resolving the user or built-in type to use. When binding these during bootstrap (as currently handled), this causes difficulty since they can define a type of either basic or composite nature. We simply do not know early enough which nature is intended. E.g.As we start binding this entity, we have no idea whether this attribute is a basic type or a composite. Naively speaking, we could just "peek" at the String and try to decide what the nature is early but that actually won't work because of
@TypeDef
.I was thinking this could be as simple as introducing a single new annotation:
and then:
Or, if we see no other config options here ever:
and :
Of course, we'd need variations of this for Map keys, etc...
I also think that this should not work with
@TypeDef
, though maybe y'all have a use case in mind where that might be useful. IMO, that should be a whole new annotation as well but then we'd either need (1) to allow@Composition
(and@MapKeyComposition
, ect) to name a composition-type-def or a whole new set of type-def based@Composition
varants. Personally, I'd just avoid this mess.A related discussion then is whether to give basic user type annotations a similar treatment. My main concern there is the distinction between a user type versus a built-in type. If we decide we want to go this route, one option would be to keep
@Type
,@MapKeyType
and@TypeDef
as they are today (limiting that they only apply to basic types) and add a new annotation (with map-key variant):Beta Was this translation helpful? Give feedback.
All reactions