diff --git a/api/src/main/java/jakarta/data/metamodel/impl/TextAttributeRecord.java b/api/src/main/java/jakarta/data/metamodel/impl/TextAttributeRecord.java index bb6c62a98..a8f30f076 100644 --- a/api/src/main/java/jakarta/data/metamodel/impl/TextAttributeRecord.java +++ b/api/src/main/java/jakarta/data/metamodel/impl/TextAttributeRecord.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024,2025 Contributors to the Eclipse Foundation + * Copyright (c) 2024,2026 Contributors to the Eclipse Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ */ package jakarta.data.metamodel.impl; +import jakarta.data.Sort; import jakarta.data.metamodel.TextAttribute; /** @@ -28,4 +29,28 @@ @Deprecated(since = "1.1") public record TextAttributeRecord(String name) implements TextAttribute { + + // The following overrides preserve the Data 1.0 behavior where + // static metamodels for different entities that have an identically named + // entity attribute can create Sort instances that are equal. + + @Override + public Sort asc() { + return Sort.asc(name); + } + + @Override + public Sort ascIgnoreCase() { + return Sort.ascIgnoreCase(name); + } + + @Override + public Sort desc() { + return Sort.desc(name); + } + + @Override + public Sort descIgnoreCase() { + return Sort.descIgnoreCase(name); + } }