Hello Davide, Technically most of the knowledge is in https://hibernate.atlassian.net/browse/OGM-208 but it's definitely quite blurry for a new comer ;)
Let me try and summarize it for you. With that you'll be able to better grasp the comments in OGM-208 ## Goals We want a metadata facility as a way to pass mapping and configuration from the developer to the grid dialect / datastore provider. I will call these options. The facility should: - be expressible via annotations - be expressible via a programmatic API - be as type-safe as possible but not too hard to add configuration options This project is essentially smart plumbing so the "clients" of this API are the developers on one hand and the Datastore providers on the other hand. ## What to reuse We will most likely use Jandex to read annotations to benefit from the ORM and WildFly work esp wrt indexing. ## Scopes: overriding and refining options Each option might be: - global, per entity, per property (with optional overridability from one to the other) - global, specific to a session, specific to an operation (e.g. query) On top of that options can be polled together by functional affinities like key/value generic options, Infinispan specific options, document store options etc. ## Programmatic API The programmatic API can be used to define mapping options as well as session or even operation options. It should be type-safe and will likely look like Hibernate Search's approach more or less. This is more or less what is in the branch. Check out the package-info.java for some more information. ## Annotation We need a way to convert an annotation into calls to the programmatic API (semantically speaking at least). Something like an (meta)annotation based conversion: @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()); } } } This is todo ## Reading API Datastore providers and GridDialect implementations should be able to read back these options. This is more or less what you can see in the last few code lines of my OGM-207 comment of 27/Jul/12 6:33 PM. The seed of it is the MappingService API on the branch but it looks all untypesafe and wrong :) Let's call it unfinished. ## Expressing options in a type-safe way If you look at OGM-207's comment of 27/Jul/12 6:33 PM, you will wee an example of NamedQuery and Quorum options and the infrastructure needed. It shows how to uniquely identify an option and how to model options like quorum that are identified by their name and options like named queries that are identified by their name + a key (the query name in this case). It's available in options.Iteration2's class. ## Tests Tests are available in org.hibernate.ogm.test.mapping. ## Examples of options You can imagine the following examples of options: - quorum: express the R/W quorum (globally, per entity, per collection, per session) ; useful for dynamo based systems - WriteConcern: express the write concern options for MongoDB (globally, per entity, per collection) - Whether or not store association information in the main document or in a separate document (see MongoDB IN_ENTITY etc. We could have this option on a per collection basis and not a global setting. - all datastore specific options whether they are global or relate to one entity or one property I hope I have been clearer, fire the questions away. Emmanuel PS: JIRA no longer has a way to link to comments? On Wed 2013-05-01 9:41, Davide D'Alto wrote: > Hi, > I've started to work on the metamodel. I've look at the branch that > emmanuel created and I've rebased it to the latest master fixing all > checkstyle violations: https://github.com/DavideD/hibernate-ogm/tree/208 > > The problem is that I don't have a clear idea how the metamodel is supposed > to work, what could be a good test case to start with? > > Thanks, > Davide > _______________________________________________ > hibernate-dev mailing list > hibernate-dev@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/hibernate-dev _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev