Emmanuel Bernard edited a comment on Bug OGM-208

Downside of committing to the annotations

If we use the annotations as internal model then the relevant Jandex data will need to be
converted to annotation literals. Which might require some overhead.

If we use Jandex as the internal model, then we ask the generator to produce Jandex types.
That means we expose the datastore provider to Jandex types - at least AnnotationInstance and AnnotationValue
and this model being generic is not type-safe.

I'm thinking if we can re-map the other configuration source all to the DSL definition: if the DSL defines standard bean setters for the option, we invoke them?

In some ways the generator is the getter to get an internal model from the programmatic API.
So if we have a source X to generator call, we could do that you are describing.

eg

@ToInternalModel(UnsafeConverter.class)
@interface Unsafe {
    boolean value() default true;
    static class UnsafeConverter implements Convert<Unsafe,MongoDBMappingInternalModelGenerator> {
        void call(Unsafe annotation, MongoDBMappingInternalModelGenerator generator) {
            return generator.unsafe(annotation.value());
        }
    }
}

1. global options
2. XML
3. annotations
4. programmatic
5. runtime: session
6. runtime: statement

I more or less agree, though XML probably should have precedence over an XML mapping file unless you're
talking about persistence.xml.

The complex part is when you need to decide the following:

  • Programmatically or via annotation, I override unsafe for entity Sample.
  • on the session, I override the global unsafe setting

What is the value for unsafe on Sample?

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira