[hibernate-dev] MetadataSourceProcessor and associations

Gail Badner gbadner at redhat.com
Thu Jan 24 00:26:17 EST 2013


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 constructor;
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 4).

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?

Regards,
Gail

----- Original Message -----
> From: "Steve Ebersole" <steven.ebersole at gmail.com>
> To: "Gail Badner" <gbadner at redhat.com>
> Cc: "Hibernate hibernate-dev" <hibernate-dev at 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?
> >
> > Thanks,
> > Gail
> > _______________________________________________
> > hibernate-dev mailing list
> > hibernate-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/hibernate-dev
> 


More information about the hibernate-dev mailing list