Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ after the collection is loaded, the collection would need to be refreshed to re-
the elements. For this reason, ordered sets are not recommended - if the application
needs ordering of the set elements, a sorted set should be preferred. For this reason,
it is not covered in the User Guide. See the javadocs for `jakarta.persistence.OrderBy`
or `org.hibernate.annotations.OrderBy` for details.
or `org.hibernate.annotations.SQLOrder` for details.

There are 2 options for sorting a set - naturally or using an explicit comparator.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,33 +90,6 @@ public interface DialectOverride {
Check[] value();
}

/**
* Specializes an {@link org.hibernate.annotations.OrderBy}
* in a certain dialect.
*
* @deprecated Use {@link SQLOrder}
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
@Repeatable(OrderBys.class)
@OverridesAnnotation(org.hibernate.annotations.OrderBy.class)
@Deprecated(since = "6.3", forRemoval = true)
@interface OrderBy {
/**
* The {@link Dialect} in which this override applies.
*/
Class<? extends Dialect> dialect();
Version before() default @Version(major = MAX_VALUE);
Version sameOrAfter() default @Version(major = MIN_VALUE);

org.hibernate.annotations.OrderBy override();
}
@Target({METHOD, FIELD})
@Retention(RUNTIME)
@interface OrderBys {
OrderBy[] value();
}

/**
* Specializes an {@link org.hibernate.annotations.SQLOrder}
* in a certain dialect.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ public abstract class CollectionBinder {
private boolean hibernateExtensionMapping;

private jakarta.persistence.OrderBy jpaOrderBy;
private org.hibernate.annotations.OrderBy sqlOrderBy;
private SQLOrder sqlOrder;
private SortNatural naturalSort;
private SortComparator comparatorSort;
Expand Down Expand Up @@ -287,7 +286,6 @@ public static void bindCollection(
collectionBinder.setMapKey( property.getAnnotationUsage( MapKey.class, sourceModelContext ) );
collectionBinder.setPropertyName( inferredData.getPropertyName() );
collectionBinder.setJpaOrderBy( property.getAnnotationUsage( OrderBy.class, sourceModelContext ) );
collectionBinder.setSqlOrderBy( getOverridableAnnotation( property, org.hibernate.annotations.OrderBy.class, context ) );
collectionBinder.setSqlOrder( getOverridableAnnotation( property, SQLOrder.class, context ) );
collectionBinder.setNaturalSort( property.getAnnotationUsage( SortNatural.class, sourceModelContext ) );
collectionBinder.setComparatorSort( property.getAnnotationUsage( SortComparator.class, sourceModelContext ) );
Expand Down Expand Up @@ -841,11 +839,6 @@ public void setJpaOrderBy(jakarta.persistence.OrderBy jpaOrderBy) {
this.jpaOrderBy = jpaOrderBy;
}

@SuppressWarnings("removal")
public void setSqlOrderBy(org.hibernate.annotations.OrderBy sqlOrderBy) {
this.sqlOrderBy = sqlOrderBy;
}

public void setSqlOrder(SQLOrder sqlOrder) {
this.sqlOrder = sqlOrder;
}
Expand Down Expand Up @@ -1095,7 +1088,7 @@ private static CollectionClassification determineCollectionClassification(
}

if ( property.hasDirectAnnotationUsage( jakarta.persistence.OrderBy.class )
|| property.hasDirectAnnotationUsage( org.hibernate.annotations.OrderBy.class ) ) {
|| property.hasDirectAnnotationUsage( org.hibernate.annotations.SQLOrder.class ) ) {
return CollectionClassification.BAG;
}

Expand Down Expand Up @@ -1443,15 +1436,12 @@ else if ( comparatorSort != null ) {
comparatorClass = null;
}

if ( jpaOrderBy != null && ( sqlOrderBy != null || sqlOrder != null ) ) {
if ( jpaOrderBy != null && sqlOrder != null ) {
throw buildIllegalOrderCombination();
}
boolean ordered = jpaOrderBy != null || sqlOrderBy != null || sqlOrder != null ;
final boolean ordered = jpaOrderBy != null || sqlOrder != null ;
if ( ordered ) {
// we can only apply the sql-based order by up front. The jpa order by has to wait for second pass
if ( sqlOrderBy != null ) {
collection.setOrderBy( sqlOrderBy.clause() );
}
if ( sqlOrder != null ) {
collection.setOrderBy( sqlOrder.value() );
}
Expand Down Expand Up @@ -1490,7 +1480,7 @@ private AnnotationException buildIllegalOrderCombination() {
"Collection '%s' is annotated both '@%s' and '@%s'",
safeCollectionRole(),
jakarta.persistence.OrderBy.class.getName(),
org.hibernate.annotations.OrderBy.class.getName()
org.hibernate.annotations.SQLOrder.class.getName()
)
);
}
Expand All @@ -1502,7 +1492,7 @@ private AnnotationException buildIllegalOrderAndSortCombination() {
"Collection '%s' is both sorted and ordered (only one of '@%s', '@%s', '@%s', and '@%s' may be used)",
safeCollectionRole(),
jakarta.persistence.OrderBy.class.getName(),
org.hibernate.annotations.OrderBy.class.getName(),
org.hibernate.annotations.SQLOrder.class.getName(),
SortComparator.class.getName(),
SortNatural.class.getName()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
import java.util.Map;
import java.util.function.Supplier;

import org.hibernate.AnnotationException;
import org.hibernate.MappingException;
import org.hibernate.annotations.OrderBy;
import org.hibernate.boot.spi.MetadataBuildingContext;
import org.hibernate.boot.spi.SecondPass;
import org.hibernate.mapping.Collection;
Expand Down Expand Up @@ -47,13 +45,6 @@ protected Collection createCollection(PersistentClass owner) {
return new List( getCustomTypeBeanResolver(), owner, getBuildingContext() );
}

@Override
public void setSqlOrderBy(OrderBy orderByAnn) {
if ( orderByAnn != null ) {
throw new AnnotationException( "A collection of type 'List' is annotated '@OrderBy'" );
}
}

@Override
public SecondPass getSecondPass() {
return new CollectionSecondPass( ListBinder.this.collection ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import java.util.function.Supplier;

import org.hibernate.annotations.OrderBy;
import org.hibernate.boot.spi.MetadataBuildingContext;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.PersistentClass;
Expand Down Expand Up @@ -34,10 +33,4 @@ protected Collection createCollection(PersistentClass persistentClass) {
return new Set( getCustomTypeBeanResolver(), persistentClass, getBuildingContext() );
}

@Override
public void setSqlOrderBy(OrderBy orderByAnn) {
if ( orderByAnn != null ) {
super.setSqlOrderBy( orderByAnn );
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
import org.hibernate.boot.models.annotations.internal.OverriddenGeneratedColumnsAnnotation;
import org.hibernate.boot.models.annotations.internal.OverriddenJoinFormulaAnnotation;
import org.hibernate.boot.models.annotations.internal.OverriddenJoinFormulasAnnotation;
import org.hibernate.boot.models.annotations.internal.OverriddenOrderByAnnotation;
import org.hibernate.boot.models.annotations.internal.OverriddenOrderBysAnnotation;
import org.hibernate.boot.models.annotations.internal.OverriddenSQLDeleteAllAnnotation;
import org.hibernate.boot.models.annotations.internal.OverriddenSQLDeleteAllsAnnotation;
import org.hibernate.boot.models.annotations.internal.OverriddenSQLDeleteAnnotation;
Expand Down Expand Up @@ -61,15 +59,6 @@ public interface DialectOverrideAnnotations {
OverriddenCheckAnnotation.class,
DIALECT_OVERRIDE_CHECKS
);
OrmAnnotationDescriptor<DialectOverride.OrderBys, OverriddenOrderBysAnnotation> DIALECT_OVERRIDE_ORDER_BYS = new OrmAnnotationDescriptor<>(
DialectOverride.OrderBys.class,
OverriddenOrderBysAnnotation.class
);
OrmAnnotationDescriptor<DialectOverride.OrderBy, OverriddenOrderByAnnotation> DIALECT_OVERRIDE_ORDER_BY = new OrmAnnotationDescriptor<>(
DialectOverride.OrderBy.class,
OverriddenOrderByAnnotation.class,
DIALECT_OVERRIDE_ORDER_BYS
);
OrmAnnotationDescriptor<DialectOverride.ColumnDefaults, OverriddenColumnDefaultsAnnotation> DIALECT_OVERRIDE_COLUMN_DEFAULTS = new OrmAnnotationDescriptor<>(
DialectOverride.ColumnDefaults.class,
OverriddenColumnDefaultsAnnotation.class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,10 +470,6 @@ public interface HibernateAnnotations {
OptimisticLocking.class,
OptimisticLockingAnnotation.class
);
OrmAnnotationDescriptor<OrderBy,OrderByAnnotation> ORDER_BY = new OrmAnnotationDescriptor<>(
OrderBy.class,
OrderByAnnotation.class
);
OrmAnnotationDescriptor<ParamDef,ParamDefAnnotation> PARAM_DEF = new OrmAnnotationDescriptor<>(
ParamDef.class,
ParamDefAnnotation.class
Expand Down

This file was deleted.

This file was deleted.

Loading
Loading