HHH-7224: Added metamodel support for Orderable and Sortable sources
This commit is contained in:
parent
ce2f359d05
commit
4eb057f4de
File diff suppressed because it is too large
Load Diff
|
@ -53,7 +53,7 @@ public class SetAttributeSourceImpl extends AbstractPluralAttributeSourceImpl im
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSorted() {
|
public boolean isSorted() {
|
||||||
return StringHelper.isNotEmpty( getComparatorName() );
|
return StringHelper.isNotEmpty( getComparatorName() ) && !getComparatorName().equals("unsorted");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,14 +25,11 @@ package org.hibernate.metamodel.spi.binding;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
import org.hibernate.AssertionFailure;
|
import org.hibernate.AssertionFailure;
|
||||||
import org.hibernate.FetchMode;
|
import org.hibernate.FetchMode;
|
||||||
import org.hibernate.engine.FetchStyle;
|
import org.hibernate.engine.FetchStyle;
|
||||||
import org.hibernate.engine.FetchTiming;
|
import org.hibernate.engine.FetchTiming;
|
||||||
import org.hibernate.metamodel.spi.domain.PluralAttribute;
|
import org.hibernate.metamodel.spi.domain.PluralAttribute;
|
||||||
import org.hibernate.metamodel.spi.relational.TableSpecification;
|
|
||||||
import org.hibernate.metamodel.spi.source.MetaAttributeContext;
|
import org.hibernate.metamodel.spi.source.MetaAttributeContext;
|
||||||
import org.hibernate.persister.collection.CollectionPersister;
|
import org.hibernate.persister.collection.CollectionPersister;
|
||||||
|
|
||||||
|
@ -59,7 +56,7 @@ public abstract class AbstractPluralAttributeBinding extends AbstractAttributeBi
|
||||||
private String where;
|
private String where;
|
||||||
private String orderBy;
|
private String orderBy;
|
||||||
private boolean sorted;
|
private boolean sorted;
|
||||||
private Comparator comparator;
|
private Comparator< ? > comparator;
|
||||||
private String comparatorClassName;
|
private String comparatorClassName;
|
||||||
|
|
||||||
private String customLoaderName;
|
private String customLoaderName;
|
||||||
|
@ -71,7 +68,7 @@ public abstract class AbstractPluralAttributeBinding extends AbstractAttributeBi
|
||||||
private String referencedPropertyName;
|
private String referencedPropertyName;
|
||||||
|
|
||||||
private final java.util.Map filters = new HashMap();
|
private final java.util.Map filters = new HashMap();
|
||||||
private final java.util.Set<String> synchronizedTables = new HashSet<String>();
|
// private final java.util.Set<String> synchronizedTables = new HashSet<String>();
|
||||||
|
|
||||||
protected AbstractPluralAttributeBinding(
|
protected AbstractPluralAttributeBinding(
|
||||||
AttributeBindingContainer container,
|
AttributeBindingContainer container,
|
||||||
|
@ -289,11 +286,11 @@ public abstract class AbstractPluralAttributeBinding extends AbstractAttributeBi
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Comparator getComparator() {
|
public Comparator< ? > getComparator() {
|
||||||
return comparator;
|
return comparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setComparator(Comparator comparator) {
|
public void setComparator( Comparator< ? > comparator ) {
|
||||||
this.comparator = comparator;
|
this.comparator = comparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.metamodel.spi.binding;
|
package org.hibernate.metamodel.spi.binding;
|
||||||
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.mapping.PropertyGeneration;
|
import org.hibernate.mapping.PropertyGeneration;
|
||||||
|
@ -212,7 +211,6 @@ public interface AttributeBindingContainer {
|
||||||
* @param includedInOptimisticLocking
|
* @param includedInOptimisticLocking
|
||||||
* @param lazy
|
* @param lazy
|
||||||
* @param metaAttributeContext
|
* @param metaAttributeContext
|
||||||
* @param comparator
|
|
||||||
*
|
*
|
||||||
* @return The attribute binding instance.
|
* @return The attribute binding instance.
|
||||||
*/
|
*/
|
||||||
|
@ -223,8 +221,7 @@ public interface AttributeBindingContainer {
|
||||||
String propertyAccessorName,
|
String propertyAccessorName,
|
||||||
boolean includedInOptimisticLocking,
|
boolean includedInOptimisticLocking,
|
||||||
boolean lazy,
|
boolean lazy,
|
||||||
MetaAttributeContext metaAttributeContext,
|
MetaAttributeContext metaAttributeContext );
|
||||||
Comparator comparator);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Seeks out the entity binding that is the root of this component path.
|
* Seeks out the entity binding that is the root of this component path.
|
||||||
|
|
|
@ -25,7 +25,6 @@ package org.hibernate.metamodel.spi.binding;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -343,8 +342,7 @@ public class CompositeAttributeBinding
|
||||||
String propertyAccessorName,
|
String propertyAccessorName,
|
||||||
boolean includedInOptimisticLocking,
|
boolean includedInOptimisticLocking,
|
||||||
boolean lazy,
|
boolean lazy,
|
||||||
MetaAttributeContext metaAttributeContext,
|
MetaAttributeContext metaAttributeContext ) {
|
||||||
Comparator comparator) {
|
|
||||||
Helper.checkPluralAttributeNature( attribute, PluralAttributeNature.SET );
|
Helper.checkPluralAttributeNature( attribute, PluralAttributeNature.SET );
|
||||||
final SetBinding binding = new SetBinding(
|
final SetBinding binding = new SetBinding(
|
||||||
this,
|
this,
|
||||||
|
@ -354,8 +352,7 @@ public class CompositeAttributeBinding
|
||||||
propertyAccessorName,
|
propertyAccessorName,
|
||||||
includedInOptimisticLocking,
|
includedInOptimisticLocking,
|
||||||
lazy,
|
lazy,
|
||||||
metaAttributeContext,
|
metaAttributeContext
|
||||||
comparator
|
|
||||||
);
|
);
|
||||||
registerAttributeBinding( attribute.getName(), binding );
|
registerAttributeBinding( attribute.getName(), binding );
|
||||||
return binding;
|
return binding;
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
package org.hibernate.metamodel.spi.binding;
|
package org.hibernate.metamodel.spi.binding;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -648,8 +647,7 @@ public class EntityBinding implements AttributeBindingContainer {
|
||||||
String propertyAccessorName,
|
String propertyAccessorName,
|
||||||
boolean includedInOptimisticLocking,
|
boolean includedInOptimisticLocking,
|
||||||
boolean lazy,
|
boolean lazy,
|
||||||
MetaAttributeContext metaAttributeContext,
|
MetaAttributeContext metaAttributeContext ) {
|
||||||
Comparator comparator) {
|
|
||||||
Helper.checkPluralAttributeNature( attribute, PluralAttributeNature.SET );
|
Helper.checkPluralAttributeNature( attribute, PluralAttributeNature.SET );
|
||||||
final SetBinding binding = new SetBinding(
|
final SetBinding binding = new SetBinding(
|
||||||
this,
|
this,
|
||||||
|
@ -659,8 +657,7 @@ public class EntityBinding implements AttributeBindingContainer {
|
||||||
propertyAccessorName,
|
propertyAccessorName,
|
||||||
includedInOptimisticLocking,
|
includedInOptimisticLocking,
|
||||||
lazy,
|
lazy,
|
||||||
metaAttributeContext,
|
metaAttributeContext
|
||||||
comparator
|
|
||||||
);
|
);
|
||||||
registerAttributeBinding( attribute.getName(), binding );
|
registerAttributeBinding( attribute.getName(), binding );
|
||||||
return binding;
|
return binding;
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.metamodel.spi.binding;
|
package org.hibernate.metamodel.spi.binding;
|
||||||
|
|
||||||
import java.util.Comparator;
|
|
||||||
|
|
||||||
import org.hibernate.metamodel.spi.domain.PluralAttribute;
|
import org.hibernate.metamodel.spi.domain.PluralAttribute;
|
||||||
import org.hibernate.metamodel.spi.source.MetaAttributeContext;
|
import org.hibernate.metamodel.spi.source.MetaAttributeContext;
|
||||||
|
|
||||||
|
@ -32,7 +30,6 @@ import org.hibernate.metamodel.spi.source.MetaAttributeContext;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class SetBinding extends AbstractPluralAttributeBinding {
|
public class SetBinding extends AbstractPluralAttributeBinding {
|
||||||
private final Comparator comparator;
|
|
||||||
|
|
||||||
public SetBinding(
|
public SetBinding(
|
||||||
AttributeBindingContainer container,
|
AttributeBindingContainer container,
|
||||||
|
@ -42,8 +39,7 @@ public class SetBinding extends AbstractPluralAttributeBinding {
|
||||||
String propertyAccessorName,
|
String propertyAccessorName,
|
||||||
boolean includedInOptimisticLocking,
|
boolean includedInOptimisticLocking,
|
||||||
boolean isLazy,
|
boolean isLazy,
|
||||||
MetaAttributeContext metaAttributeContext,
|
MetaAttributeContext metaAttributeContext ) {
|
||||||
Comparator comparator) {
|
|
||||||
super(
|
super(
|
||||||
container,
|
container,
|
||||||
attribute,
|
attribute,
|
||||||
|
@ -54,10 +50,5 @@ public class SetBinding extends AbstractPluralAttributeBinding {
|
||||||
isLazy,
|
isLazy,
|
||||||
metaAttributeContext
|
metaAttributeContext
|
||||||
);
|
);
|
||||||
this.comparator = comparator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Comparator getComparator() {
|
|
||||||
return comparator;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue