-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Manually creating index objects #117
Comments
@sebersole we should chat sometime about this use-case. Are you thinking this is an override mechanism, like ideally you would read from bytecode, and then seed the mocks, which you then modify with the orm.xml metadata? |
@n1hility To be honest, I really have no idea how to accomplish this best. We have a working prototype of this, but:
I had kind of hoped I could do something like leverage a CompositeIndex composing (1) the "real" Index and then (2) an "overide" Index, preferring the override form. But like I said, I got into trouble with the need to duplicate stuff. Just looking for some hints/guidance |
@sebersole the most common pattern I have seen is that there is a metadata model or DSL that represents the true "configuration", and then the annotations and the XML just feed into that following the specific override rules. The model you describe I think makes sense if the natural contract is 100% equivalent subset to the Java structure. Otherwise you will end up emulating config style structures as made up Java types, which can get a little strange. For example, it's more intuitive to say config.description() than to say clazz.field("something).annotation("Description"). I haven't looked at orm.xml in awhile. I should take a look. |
There are basically 2 modes of interpreting an Complete mappings fully define the model, meaning even if there are annotations available we will ignore them. This is specified in the mapping itself. Incomplete mappings are interpreted as overrides. Like say the annotations say to map your attribute "description" to a column named "description", the I think what you are asking (the "100% equivalent" part is confusing) is whether the As for the approach of a "meta model" or DSL, sure. We have something like that obviously. What you suggest would be using our The mapping model serves a lot of different roles across many projects and we are very careful about changes there. |
For the historical record... It was suggested I try looking at https://github.com/quarkusio/quarkus/blob/main/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/transformation/AnnotationStore.java and https://github.com/quarkusio/quarkus/blob/main/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AnnotationStore.java for inspiration - preferring the first as it is "easier" |
Hey Jason, etal. I started playing around again with using Jandex in Hibernate.
The thing I am still unsure of is how to manually build ClassInfo, MethodInfo, etc objects. For background, this is related to applying
orm.xml
mapping overrides. I realize this is a unique use-case, but wondered if you know of anything else using Jandex in a similar fashion or thoughts on how to best accomplish this.The main thing I run into is that I need to re-create all of the AnnotationTarget references, which seems to get messy
The text was updated successfully, but these errors were encountered: