diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/Metadata.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/Metadata.java index be63760d16..fba625fe0c 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/Metadata.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/Metadata.java @@ -28,4 +28,9 @@ package org.hibernate.metamodel.source; * @author Steve Ebersole */ public interface Metadata { + public static enum ProcessingOrder { + ANNOTATIONS_FIRST, + HBM_FIRST + } + } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/MetadataSources.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/MetadataSources.java index bcb672cb5c..8a28f91c24 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/MetadataSources.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/MetadataSources.java @@ -90,7 +90,11 @@ public class MetadataSources { } public Metadata buildMetadata() { - return new MetadataImpl( this ); + return buildMetadata( Metadata.ProcessingOrder.ANNOTATIONS_FIRST ); + } + + public Metadata buildMetadata(Metadata.ProcessingOrder preferredProcessingOrder) { + return new MetadataImpl( this, preferredProcessingOrder ); } /** diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/internal/MetadataImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/internal/MetadataImpl.java index 17ab7f2886..d62a61ae9f 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/internal/MetadataImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/internal/MetadataImpl.java @@ -65,7 +65,7 @@ public class MetadataImpl implements Metadata, MetadataImplementor, Serializable private Map fetchProfiles = new HashMap(); private Map imports; - public MetadataImpl(MetadataSources metadataSources) { + public MetadataImpl(MetadataSources metadataSources, ProcessingOrder preferredProcessingOrder) { this.serviceRegistry = metadataSources.getServiceRegistry(); this.namingStrategy = metadataSources.getNamingStrategy();