On Jan 24, 2013, at 1:26 PM, Gail Badner <gbadner(a)redhat.com> wrote:
I am trying to figure out when we have all the necessary information
to resolve everything required for associations.
IIUC, sources are processed in the following order by default:
1) HBM sources extracted from MetadataSources passed to MetadataImpl constructor;
2) annotations sources extracted from MetadataSources passed to MetadataImpl
3) (annotations?) sources contributed by MetadataContributor service;
4) HBM sources from JaxbRoot objects produced by AdditionalJaxbRootProducer service.
The same Binder is used create bindings from 1) and 2). A different Binder is used for
I am not familiar with how 3) and 4) are intended to be used.
Does 3) make "contributions" directly to the MetadataImpl? What kind of
contributions are they?
Can 3) and 4) result in added or changed EntityBindings?
IIUC, 3) is for extensions that want to create / modify metamodel ( binding / relational
/ domain ) directly
4) is for extensions what want to contribute hbm sources and let the Binder to do the
take envers as an example, for each entity with @Audit, envers creates an internal entity
and associate it with the original one.
the current impl ( with old metamodel )
1. new Configuration -- mapping process
2. building SF
2.1 calling Integrator, which envers come into play, it just review all entities and
find out the audit entities, then create hbm xml documents for each one, add these hbm
documents into Configuration and call the buildMappings again
2.2 SF cons process continues, this time, the persister factory sees the new
Configuration processed mappings ( envers created hbm included)
so, to achieve this in the new metamodel design, extensions can choose which way is easier
1. the same way as envers currently does (creating hbm in memory and ask hibernate to do
the binding stuff) -- 4)
2. create/change metamodel directly -- 3)
----- Original Message -----
> From: "Steve Ebersole" <steven.ebersole(a)gmail.com>
> To: "Gail Badner" <gbadner(a)redhat.com>
> Cc: "Hibernate hibernate-dev" <hibernate-dev(a)lists.jboss.org>
> Sent: Wednesday, January 23, 2013 11:16:23 AM
> Subject: Re: [hibernate-dev] MetadataSourceProcessor and associations
> What you mention is in fact possible.
> And I have never been very hopeful about the "chasing" approach...
> On Wed 23 Jan 2013 01:13:48 PM CST, Gail Badner wrote:
>> Is it possible for an entity containing one side of an association
>> be mapped using annotations and the entity containing the opposite
>> side of the association be mapped using an hbm mapping?
>> For example, suppose Order has annotations:
>> @OneToMany( mappedby="order" )
>> List<OrderLine> Order.orderLines
>> OrderLine is mapped using hbm.xml with:
>> <many-to-one name="order"/>
>> If annotations are processed first, then, IIUC, when
>> Order.orderLines is processed, the mapping for OrderLine won't be
>> found (via chasing) because the
>> AnnotationMetadataSourceProcessorImpl does not have the source for
>> the OrderLine mapping. As a result, the OrderLine EntityBinding
>> will not be able to be built until HbmMetadataSourceProcessorImpl
>> is processed.
>> If so, this poses a fundamental problem with entity "chasing" as it
>> is implemented now, since the associated entity would not be
>> processed by the same MetadataSourceProcessor.
>> Am I missing something here?
>> hibernate-dev mailing list
hibernate-dev mailing list
Strong Liu <stliu at hibernate.org>