if (! accessor.isProcessed()) {
// If we a mapped key map accessor with an embeddable as the
// key, process that embeddable accessor now.
if (accessor.isMappedKeyMapAccessor()) {
MappedKeyMapAccessor mapAccessor = (MappedKeyMapAccessor) accessor;
EmbeddableAccessor mapKeyEmbeddableAccessor = getProject().getEmbeddableAccessor(mapAccessor.getMapKeyClass());
if (mapKeyEmbeddableAccessor != null && ! mapKeyEmbeddableAccessor.isProcessed()) {
mapKeyEmbeddableAccessor.process();
}
}
// We need to defer the processing of some mappings to stage
// 3 processing. Accessors are added to different lists since
// the order or processing of those accessors is important.
// See MetadataProject.processStage2() for more details.
// Care must be taken in the order of checking here.
if (accessor.isDirectEmbeddableCollection() || accessor.isEmbedded()) {
EmbeddableAccessor embeddableAccessor = getProject().getEmbeddableAccessor(accessor.getReferenceClass());
// If there is no embeddable accessor at this point,
// something is wrong, throw an exception. Note a direct
// embeddable collection can't hit here since we don't build
// a direct embeddable collection if the reference class is
// not an Embeddable.
if (embeddableAccessor == null) {
throw ValidationException.invalidEmbeddedAttribute(getJavaClass(), accessor.getAttributeName(), accessor.getReferenceClass());
} else {
// Process the embeddable class now (if it's not already processed)
if (! embeddableAccessor.isProcessed()) {
embeddableAccessor.process();
}
// Store this descriptor metadata. It may be needed again
// later on to look up a mappedBy attribute etc.
addEmbeddableDescriptor(embeddableAccessor.getDescriptor());
// Since association overrides are not allowed on
// embeddedid's we can and must process it right now,
// instead of deferring it till after the relationship
// accessors have processed.