HHH-2394 Remove conditions that blocked filters on sub-classes (for annotations)
This commit is contained in:
parent
63f2639101
commit
09547a9051
|
@ -578,10 +578,7 @@ public final class AnnotationBinder {
|
|||
entityBinder.setCache( determineCacheSettings( clazzToProcess, mappings ) );
|
||||
entityBinder.setNaturalIdCache( clazzToProcess, clazzToProcess.getAnnotation( NaturalIdCache.class ) );
|
||||
|
||||
//Filters are not allowed on subclasses
|
||||
if ( !inheritanceState.hasParents() ) {
|
||||
bindFilters( clazzToProcess, entityBinder, mappings );
|
||||
}
|
||||
bindFilters( clazzToProcess, entityBinder, mappings );
|
||||
|
||||
entityBinder.bindEntity();
|
||||
|
||||
|
|
|
@ -371,24 +371,19 @@ public class EntityBinder {
|
|||
persistentClass.addTuplizer( mode, tuplizer.impl().getName() );
|
||||
}
|
||||
|
||||
if ( !inheritanceState.hasParents() ) {
|
||||
for ( Map.Entry<String, String> filter : filters.entrySet() ) {
|
||||
String filterName = filter.getKey();
|
||||
String cond = filter.getValue();
|
||||
if ( BinderHelper.isEmptyAnnotationValue( cond ) ) {
|
||||
FilterDefinition definition = mappings.getFilterDefinition( filterName );
|
||||
cond = definition == null ? null : definition.getDefaultFilterCondition();
|
||||
if ( StringHelper.isEmpty( cond ) ) {
|
||||
throw new AnnotationException(
|
||||
"no filter condition found for filter " + filterName + " in " + this.name
|
||||
);
|
||||
}
|
||||
for ( Map.Entry<String, String> filter : filters.entrySet() ) {
|
||||
String filterName = filter.getKey();
|
||||
String cond = filter.getValue();
|
||||
if ( BinderHelper.isEmptyAnnotationValue( cond ) ) {
|
||||
FilterDefinition definition = mappings.getFilterDefinition( filterName );
|
||||
cond = definition == null ? null : definition.getDefaultFilterCondition();
|
||||
if ( StringHelper.isEmpty( cond ) ) {
|
||||
throw new AnnotationException(
|
||||
"no filter condition found for filter " + filterName + " in " + this.name
|
||||
);
|
||||
}
|
||||
persistentClass.addFilter( filterName, null, cond );
|
||||
}
|
||||
}
|
||||
else if ( filters.size() > 0 ) {
|
||||
LOG.filterAnnotationOnSubclass( persistentClass.getEntityName() );
|
||||
persistentClass.addFilter( filterName, null, cond );
|
||||
}
|
||||
LOG.debugf( "Import with entity name %s", name );
|
||||
try {
|
||||
|
|
|
@ -344,10 +344,6 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
@Message(value = "Fetching database metadata", id = 102)
|
||||
void fetchingDatabaseMetadata();
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(value = "@Filter not allowed on subclasses (ignored): %s", id = 103)
|
||||
void filterAnnotationOnSubclass(String className);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(value = "firstResult/maxResults specified with collection fetch; applying in memory!", id = 104)
|
||||
void firstOrMaxResultsSpecifiedWithCollectionFetch();
|
||||
|
|
Loading…
Reference in New Issue