[hibernate-dev] Hibernate.next version and AS 7.2 community release...

Hardy Ferentschik hardy at hibernate.org
Wed Jun 27 02:54:11 EDT 2012





On 26 Jun 2012, at 22:29, Sanne Grinovero <sanne at hibernate.org> wrote:

> On 26 June 2012 21:17, Hardy Ferentschik <hardy at hibernate.org> wrote:
>> 
>> On 26 Jun 2012, at 21:37, Sanne Grinovero <sanne at hibernate.org> wrote:
>> 
>>> Ok that sounds all nice. But we need programmatic definition of
>>> annotations too, you remember Hibernate Search right?
>> 
>> How is that conceptually different than XML defined ones?
> 
> Not conceptually, but in practice, does Jandex support this directly
> or should we add a thin layer of indirection?

Kind of directly. You create pseudo annotations the same ways as for XML configuration. Yes, we will have to write some code, but is not adding a new layer. It is just using the Jandex API. Maybe the best is to look at the code in the metamodel branch, because we are actually talking about something which is already done!

One argument I forgot, because I was more focused around why we should get rid of Commons Annotations, is that we actually want to expose the Jandex index when processing annotations (aka using the information in the annotations vs actually discovering them). Using Jandex allows us to clearly separate between annotation discovery and annotation processing. This makes code much easier to write and understand. You can for example just ask the Jandex index to give you all annotations of a certain type (independent of class hierarchies etc). You need much less reflection code when processing the annotations. 

You would give all this away if you hide it behind the XClass abstraction. You cannot take any advantage of the Jandex API, but you are stuck with the reflect and process approach we currently use.

> Plus, you're suggesting we re-wire dependencies in other modules too
> right? (like Search)

Absolutely!

--hardy


More information about the hibernate-dev mailing list