diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/entity/Doctor.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/entity/Doctor.java index 51e27107b7..3fa36481d7 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/entity/Doctor.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/entity/Doctor.java @@ -13,7 +13,7 @@ import jakarta.persistence.Enumerated; import jakarta.persistence.GeneratedValue; import jakarta.persistence.Id; -import org.hibernate.annotations.Where; +import org.hibernate.annotations.SQLRestriction; /** * @@ -21,7 +21,7 @@ import org.hibernate.annotations.Where; * */ @Entity -@Where(clause = "yearsExperience > 3") +@SQLRestriction("yearsExperience > 3") public class Doctor { private Integer id; private String name; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/entity/SoccerTeam.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/entity/SoccerTeam.java index 7e6fbc7301..dc0af199a2 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/entity/SoccerTeam.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/entity/SoccerTeam.java @@ -17,7 +17,7 @@ import jakarta.persistence.Id; import jakarta.persistence.OneToMany; import jakarta.persistence.OneToOne; -import org.hibernate.annotations.Where; +import org.hibernate.annotations.SQLRestriction; @Entity public class SoccerTeam { @@ -28,7 +28,7 @@ public class SoccerTeam { String name; @OneToMany - @Where(clause = "activeLicense = true") + @SQLRestriction("activeLicense = true") private List physiologists = new ArrayList(); @OneToMany(mappedBy="team", diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/manytomany/Group.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/manytomany/Group.java index 0646c6d9c6..9ea45fb36d 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/manytomany/Group.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/manytomany/Group.java @@ -18,8 +18,8 @@ import jakarta.persistence.Table; import org.hibernate.annotations.Filter; import org.hibernate.annotations.FilterDef; import org.hibernate.annotations.FilterJoinTable; -import org.hibernate.annotations.Where; -import org.hibernate.annotations.WhereJoinTable; +import org.hibernate.annotations.SQLJoinTableRestriction; +import org.hibernate.annotations.SQLRestriction; /** * @author Emmanuel Bernard @@ -42,8 +42,8 @@ public class Group { @ManyToMany(cascade = CascadeType.PERSIST) @OrderBy("expirationDate") - @Where(clause = "1=1") - @WhereJoinTable(clause = "2=2") + @SQLRestriction("1=1") + @SQLJoinTableRestriction("2=2") @Filter(name="Groupfilter", condition = "3=3") @FilterJoinTable(name="Groupfilter", condition = "4=4") public Collection getPermissions() { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/manytomany/GroupWithSet.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/manytomany/GroupWithSet.java index 6d86dfe5db..c74dfb25b4 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/manytomany/GroupWithSet.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/manytomany/GroupWithSet.java @@ -17,10 +17,9 @@ import jakarta.persistence.OrderBy; import jakarta.persistence.Table; import org.hibernate.annotations.Filter; -import org.hibernate.annotations.FilterDef; import org.hibernate.annotations.FilterJoinTable; -import org.hibernate.annotations.Where; -import org.hibernate.annotations.WhereJoinTable; +import org.hibernate.annotations.SQLJoinTableRestriction; +import org.hibernate.annotations.SQLRestriction; /** * @author Emmanuel Bernard @@ -42,8 +41,8 @@ public class GroupWithSet { @ManyToMany(cascade = CascadeType.PERSIST) @OrderBy("expirationDate") - @Where(clause = "1=1") - @WhereJoinTable(clause = "2=2") + @SQLRestriction("1=1") + @SQLJoinTableRestriction("2=2") @Filter(name="Groupfilter", condition = "3=3") @FilterJoinTable(name="Groupfilter", condition = "4=4") public Set getPermissions() { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/onetomany/Troop.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/onetomany/Troop.java index 11fa5fbcd6..216cc4a6de 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/onetomany/Troop.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/onetomany/Troop.java @@ -18,7 +18,7 @@ import jakarta.persistence.OneToMany; import org.hibernate.annotations.OnDelete; import org.hibernate.annotations.OnDeleteAction; -import org.hibernate.annotations.OrderBy; +import org.hibernate.annotations.SQLOrder; /** * Shows a default one to many @@ -32,7 +32,7 @@ public class Troop { private Set soldiers; @OneToMany(mappedBy = "troop", cascade = {CascadeType.ALL}, fetch = FetchType.LAZY) - @OrderBy(clause = "name desc") + @SQLOrder("name desc") @org.hibernate.annotations.Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN) @OnDelete(action = OnDeleteAction.CASCADE) public Set getSoldiers() { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/onetomany/Zoo.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/onetomany/Zoo.java index 37e348f950..a409d5dd33 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/onetomany/Zoo.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/onetomany/Zoo.java @@ -14,6 +14,7 @@ import jakarta.persistence.GeneratedValue; import jakarta.persistence.Id; import jakarta.persistence.JoinColumn; import jakarta.persistence.OneToMany; +import org.hibernate.annotations.SQLOrder; /** * Entity used to test {@code NULL} values ordering in SQL {@code ORDER BY} clause. @@ -30,7 +31,7 @@ public class Zoo implements Serializable { @OneToMany @JoinColumn(name = "zoo_id") - @org.hibernate.annotations.OrderBy(clause = "name asc nulls last") // By default H2 places NULL values first. + @SQLOrder("name asc nulls last") // By default H2 places NULL values first. private Set tigers = new HashSet(); @OneToMany diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/collection/ordered/joinedInheritence/Zoo.java b/hibernate-core/src/test/java/org/hibernate/orm/test/collection/ordered/joinedInheritence/Zoo.java index 3091306dac..2603e27dfd 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/collection/ordered/joinedInheritence/Zoo.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/collection/ordered/joinedInheritence/Zoo.java @@ -16,6 +16,7 @@ import java.util.HashSet; import java.util.Set; import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.SQLOrder; /** * @author Steve Ebersole @@ -69,7 +70,7 @@ public class Zoo { @OneToMany @JoinColumn - @org.hibernate.annotations.OrderBy( clause = "weight" ) + @SQLOrder( "weight" ) public Set getLions() { return lions; } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/hql/size/WhereClauseOrderBySizeTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/hql/size/WhereClauseOrderBySizeTest.java index f56eabcc25..96b8bb5a26 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/hql/size/WhereClauseOrderBySizeTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/hql/size/WhereClauseOrderBySizeTest.java @@ -24,6 +24,7 @@ import jakarta.persistence.TypedQuery; import org.hibernate.annotations.ResultCheckStyle; import org.hibernate.annotations.SQLDelete; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.annotations.Where; import org.hibernate.dialect.H2Dialect; import org.hibernate.dialect.PostgreSQLDialect; @@ -141,7 +142,7 @@ public class WhereClauseOrderBySizeTest extends BaseEntityManagerFunctionalTestC @Entity(name = "Book") @SQLDelete(sql = "UPDATE Book SET deleted = true WHERE id = ?", check = ResultCheckStyle.COUNT) - @Where(clause = "deleted = false") + @SQLRestriction("deleted = false") public static class Book { @Id @GeneratedValue diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/hql/size/filter/City.java b/hibernate-core/src/test/java/org/hibernate/orm/test/hql/size/filter/City.java index 826b9a2262..7e32bf8714 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/hql/size/filter/City.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/hql/size/filter/City.java @@ -10,10 +10,10 @@ import jakarta.persistence.Entity; import jakarta.persistence.Id; import jakarta.persistence.ManyToOne; -import org.hibernate.annotations.Where; +import org.hibernate.annotations.SQLRestriction; @Entity -@Where(clause = "deleted = false") +@SQLRestriction("deleted = false") public class City { @Id diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/insertordering/InsertOrderingSelfReferenceTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/insertordering/InsertOrderingSelfReferenceTest.java index 61f6185069..3263359a45 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/insertordering/InsertOrderingSelfReferenceTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/insertordering/InsertOrderingSelfReferenceTest.java @@ -19,6 +19,7 @@ import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.annotations.SortNatural; import org.hibernate.annotations.Where; @@ -104,7 +105,7 @@ public class InsertOrderingSelfReferenceTest extends BaseInsertOrderingTest { @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "parent") @SortNatural - @Where(clause = "TYPE = 'INPUT'") + @SQLRestriction("TYPE = 'INPUT'") @Fetch(FetchMode.SUBSELECT) List children = new ArrayList<>(); } @@ -118,7 +119,7 @@ public class InsertOrderingSelfReferenceTest extends BaseInsertOrderingTest { @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "parent") @SortNatural - @Where(clause = "TYPE = 'OUTPUT'") + @SQLRestriction("TYPE = 'OUTPUT'") @Fetch(FetchMode.SUBSELECT) @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) List children = new ArrayList<>(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/cascade/Troop.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/cascade/Troop.java index ee2708c7b6..981dc8ef8f 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/cascade/Troop.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/cascade/Troop.java @@ -18,7 +18,7 @@ import jakarta.persistence.GeneratedValue; import jakarta.persistence.Id; import jakarta.persistence.OneToMany; -import org.hibernate.annotations.OrderBy; +import org.hibernate.annotations.SQLOrder; /** * @author Emmanuel Bernard @@ -30,7 +30,7 @@ public class Troop implements Serializable { private Set soldiers; @OneToMany(mappedBy = "troop", cascade = {CascadeType.ALL}, fetch = FetchType.LAZY) - @OrderBy(clause = "name desc") + @SQLOrder("name desc") @org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.DELETE_ORPHAN}) public Set getSoldiers() { return soldiers; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/manytomany/Advertisement.java b/hibernate-core/src/test/java/org/hibernate/orm/test/manytomany/Advertisement.java index 85cfbe6927..89c77f0b8f 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/manytomany/Advertisement.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/manytomany/Advertisement.java @@ -6,7 +6,7 @@ */ package org.hibernate.orm.test.manytomany; -import org.hibernate.annotations.Where; +import org.hibernate.annotations.SQLRestriction; import jakarta.persistence.Entity; import jakarta.persistence.FetchType; @@ -25,7 +25,7 @@ public class Advertisement { @GeneratedValue private Integer id; - @Where(clause = "deleted <> 'true'") + @SQLRestriction("deleted <> 'true'") @ManyToMany(fetch = FetchType.EAGER, mappedBy = "advertisements") @OrderBy("id asc") private Set attachments; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/OrderedBySQLTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/OrderedBySQLTest.java index 871709d957..671a1d1729 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/OrderedBySQLTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/collections/OrderedBySQLTest.java @@ -18,6 +18,7 @@ import jakarta.persistence.Id; import jakarta.persistence.ManyToOne; import jakarta.persistence.OneToMany; +import org.hibernate.annotations.SQLOrder; import org.hibernate.dialect.H2Dialect; import org.hibernate.metamodel.CollectionClassification; import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase; @@ -94,9 +95,7 @@ public class OrderedBySQLTest extends BaseEntityManagerFunctionalTestCase { mappedBy = "person", cascade = CascadeType.ALL ) - @org.hibernate.annotations.OrderBy( - clause = "CHAR_LENGTH(name) DESC" - ) + @SQLOrder("CHAR_LENGTH(name) DESC") private List
articles = new ArrayList<>(); //Getters and setters are omitted for brevity diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/where/DiscriminatorWhereTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/where/DiscriminatorWhereTest.java index 5616e6979c..76d8998260 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/where/DiscriminatorWhereTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/where/DiscriminatorWhereTest.java @@ -8,7 +8,7 @@ package org.hibernate.orm.test.mapping.where; import java.util.Set; -import org.hibernate.annotations.Where; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.JiraKey; @@ -71,7 +71,7 @@ public class DiscriminatorWhereTest { @OneToMany @JoinColumn(name = "allC") - @Where(clause = "type = 'C'") + @SQLRestriction("type = 'C'") private Set allMyC; public Integer getId() { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/where/UserDetail.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/where/UserDetail.java index cfb0969b5b..dfdc6f1e14 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/where/UserDetail.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/where/UserDetail.java @@ -6,7 +6,7 @@ */ package org.hibernate.orm.test.mapping.where; -import org.hibernate.annotations.Where; +import org.hibernate.annotations.SQLRestriction; import jakarta.persistence.Column; import jakarta.persistence.Entity; @@ -19,7 +19,7 @@ import static jakarta.persistence.FetchType.LAZY; import static java.text.MessageFormat.format; import static java.util.Objects.hash; -@Where(clause = "is_active = true") +@SQLRestriction("is_active = true") @Table(name = "t_user_details") @Entity(name = "UserDetail") public class UserDetail { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/where/UserSkill.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/where/UserSkill.java index e0808da8f4..29121942fc 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/where/UserSkill.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/where/UserSkill.java @@ -6,7 +6,7 @@ */ package org.hibernate.orm.test.mapping.where; -import org.hibernate.annotations.Where; +import org.hibernate.annotations.SQLRestriction; import jakarta.persistence.Column; import jakarta.persistence.Entity; @@ -19,7 +19,7 @@ import static jakarta.persistence.FetchType.LAZY; import static java.text.MessageFormat.format; import static java.util.Objects.hash; -@Where(clause = "has_deleted = false") +@SQLRestriction("has_deleted = false") @Table(name = "t_user_skills") @Entity(name = "UserSkill") public class UserSkill { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/pc/WhereJoinTableTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/pc/WhereJoinTableTest.java index e5d6d97752..865b383d10 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/pc/WhereJoinTableTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/pc/WhereJoinTableTest.java @@ -18,7 +18,7 @@ import jakarta.persistence.JoinTable; import jakarta.persistence.ManyToMany; import org.hibernate.Session; -import org.hibernate.annotations.WhereJoinTable; +import org.hibernate.annotations.SQLJoinTableRestriction; import org.hibernate.dialect.H2Dialect; import org.hibernate.metamodel.CollectionClassification; import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase; @@ -127,7 +127,7 @@ public class WhereJoinTableTest extends BaseEntityManagerFunctionalTestCase { joinColumns = @JoinColumn(name = "book_id"), inverseJoinColumns = @JoinColumn(name = "reader_id") ) - @WhereJoinTable(clause = "created_on > DATEADD('DAY', -7, CURRENT_TIMESTAMP())") + @SQLJoinTableRestriction("created_on > DATEADD('DAY', -7, CURRENT_TIMESTAMP())") private List currentWeekReaders = new ArrayList<>(); //Getters and setters omitted for brevity diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/pc/WhereTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/pc/WhereTest.java index 51f19dddab..29eac595a9 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/pc/WhereTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/pc/WhereTest.java @@ -18,7 +18,7 @@ import jakarta.persistence.Id; import jakarta.persistence.ManyToOne; import jakarta.persistence.OneToMany; -import org.hibernate.annotations.Where; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.metamodel.CollectionClassification; import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase; @@ -122,11 +122,11 @@ public class WhereTest extends BaseEntityManagerFunctionalTestCase { private String name; - @Where(clause = "account_type = 'DEBIT'") + @SQLRestriction("account_type = 'DEBIT'") @OneToMany(mappedBy = "client") private List debitAccounts = new ArrayList<>(); - @Where(clause = "account_type = 'CREDIT'") + @SQLRestriction("account_type = 'CREDIT'") @OneToMany(mappedBy = "client") private List creditAccounts = new ArrayList<>(); @@ -160,7 +160,7 @@ public class WhereTest extends BaseEntityManagerFunctionalTestCase { } @Entity(name = "Account") - @Where(clause = "active = true") + @SQLRestriction("active = true") public static class Account { @Id diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hhh14112/HHH14112Test.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hhh14112/HHH14112Test.java index 88a01a49c1..a60e7f9269 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hhh14112/HHH14112Test.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hhh14112/HHH14112Test.java @@ -7,7 +7,7 @@ import jakarta.persistence.Id; import jakarta.persistence.Inheritance; import jakarta.persistence.InheritanceType; -import org.hibernate.annotations.Where; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; @@ -36,7 +36,7 @@ public class HHH14112Test extends BaseCoreFunctionalTestCase { @Entity(name = "Super") @Inheritance(strategy = InheritanceType.JOINED) - @Where(clause = "deleted = false") + @SQLRestriction("deleted = false") public static class Super { @Id @GeneratedValue(strategy = GenerationType.AUTO) diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/sql/CustomSQLTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/sql/CustomSQLTest.java index f992d85959..cc10848c14 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/sql/CustomSQLTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/sql/CustomSQLTest.java @@ -24,8 +24,8 @@ import org.hibernate.annotations.ResultCheckStyle; import org.hibernate.annotations.SQLDelete; import org.hibernate.annotations.SQLDeleteAll; import org.hibernate.annotations.SQLInsert; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.annotations.SQLUpdate; -import org.hibernate.annotations.Where; import org.hibernate.dialect.H2Dialect; import org.hibernate.dialect.PostgreSQLDialect; import org.hibernate.metamodel.CollectionClassification; @@ -142,7 +142,7 @@ public class CustomSQLTest extends BaseEntityManagerFunctionalTestCase { sql = "INSERT INTO person_phones (person_id, phones, valid) VALUES (?, ?, true) ") @SQLDeleteAll( sql = "UPDATE person_phones SET valid = false WHERE person_id = ?") - @Where(clause = "valid = true") + @SQLRestriction("valid = true") private List phones = new ArrayList<>(); //Getters and setters are omitted for brevity diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerManyToOne2Test.java b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerManyToOne2Test.java index de60d4c34d..a261e2be2a 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerManyToOne2Test.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerManyToOne2Test.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; -import org.hibernate.annotations.Where; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.orm.junit.EntityManagerFactoryScope; @@ -134,7 +134,7 @@ public class EagerManyToOne2Test { private String name; @OneToMany(mappedBy = "parent", cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true) - @Where(clause = "deleted_at IS NULL") + @SQLRestriction("deleted_at IS NULL") private List children = new ArrayList<>(); public Parent() { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerManyToOne3Test.java b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerManyToOne3Test.java index 564b5cc312..0b7cd3a3ec 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerManyToOne3Test.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerManyToOne3Test.java @@ -4,13 +4,11 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; -import org.hibernate.annotations.Where; -import org.hibernate.cfg.AvailableSettings; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.orm.junit.EntityManagerFactoryScope; import org.hibernate.testing.orm.junit.Jpa; -import org.hibernate.testing.orm.junit.Setting; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; @@ -100,7 +98,7 @@ public class EagerManyToOne3Test { @Entity(name = "Child") @Table(name = "children") - @Where(clause = "deleted_at IS NULL") + @SQLRestriction("deleted_at IS NULL") public static class Child { @Id private Long id; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerManyToOneFetchModeJoinWhereTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerManyToOneFetchModeJoinWhereTest.java index 2bd34d3ef2..be4e871a7c 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerManyToOneFetchModeJoinWhereTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerManyToOneFetchModeJoinWhereTest.java @@ -23,7 +23,7 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; -import org.hibernate.annotations.Where; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.testing.FailureExpected; import org.hibernate.testing.TestForIssue; @@ -131,7 +131,7 @@ public class EagerManyToOneFetchModeJoinWhereTest extends BaseNonConfigCoreFunct @Entity(name = "Category") @Table(name = "CATEGORY") - @Where(clause = "inactive = 0") + @SQLRestriction("inactive = 0") public static class Category { @Id @GeneratedValue diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerManyToOneFetchModeSelectWhereTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerManyToOneFetchModeSelectWhereTest.java index ce9a82a592..950d3ed996 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerManyToOneFetchModeSelectWhereTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerManyToOneFetchModeSelectWhereTest.java @@ -24,7 +24,7 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; -import org.hibernate.annotations.Where; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.cfg.AvailableSettings; import org.hibernate.testing.TestForIssue; @@ -136,7 +136,7 @@ public class EagerManyToOneFetchModeSelectWhereTest extends BaseNonConfigCoreFun @Entity(name = "Category") @Table(name = "CATEGORY") - @Where(clause = "inactive = 0") + @SQLRestriction("inactive = 0") public static class Category { @Id @GeneratedValue diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerManyToOneTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerManyToOneTest.java index 4ef484f6b7..64df0306b0 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerManyToOneTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerManyToOneTest.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; -import org.hibernate.annotations.Where; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.cfg.AvailableSettings; import org.hibernate.testing.TestForIssue; @@ -88,7 +88,7 @@ public class EagerManyToOneTest { @Entity(name = "Child") @Table(name = "children") - @Where(clause = "deleted_at IS NULL") + @SQLRestriction("deleted_at IS NULL") public static class Child { @Id private Long id; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerToManyWhereDontUseClassWhereTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerToManyWhereDontUseClassWhereTest.java index 15dbbd1e31..516816f0d3 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerToManyWhereDontUseClassWhereTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerToManyWhereDontUseClassWhereTest.java @@ -20,8 +20,8 @@ import jakarta.persistence.ManyToMany; import jakarta.persistence.OneToMany; import jakarta.persistence.Table; -import org.hibernate.annotations.Where; -import org.hibernate.annotations.WhereJoinTable; +import org.hibernate.annotations.SQLJoinTableRestriction; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.cfg.AvailableSettings; import org.hibernate.testing.TestForIssue; @@ -178,7 +178,7 @@ public class EagerToManyWhereDontUseClassWhereTest extends BaseNonConfigCoreFunc @OneToMany(fetch = FetchType.EAGER) @JoinColumn - @Where( clause = "description is not null" ) + @SQLRestriction( "description is not null" ) private Set categoriesWithDescOneToMany = new HashSet<>(); @ManyToMany(fetch = FetchType.EAGER) @@ -187,19 +187,19 @@ public class EagerToManyWhereDontUseClassWhereTest extends BaseNonConfigCoreFunc @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name = "categoriesWithDescManyToMany", inverseJoinColumns = { @JoinColumn( name = "categoryId" )}) - @Where( clause = "description is not null" ) + @SQLRestriction( "description is not null" ) private Set categoriesWithDescManyToMany = new HashSet<>(); @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name = "categoriesWithDescIdLt4MToM", inverseJoinColumns = { @JoinColumn( name = "categoryId" )}) - @Where( clause = "description is not null" ) - @WhereJoinTable( clause = "categoryId < 4") + @SQLRestriction( "description is not null" ) + @SQLJoinTableRestriction( "categoryId < 4") private Set categoriesWithDescIdLt4ManyToMany = new HashSet<>(); } @Entity(name = "Category") @Table(name = "CATEGORY") - @Where(clause = "inactive = 0") + @SQLRestriction( "inactive = 0") public static class Category { @Id private int id; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerToManyWhereTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerToManyWhereTest.java index 98f4366450..b029b05433 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerToManyWhereTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerToManyWhereTest.java @@ -19,8 +19,8 @@ import jakarta.persistence.ManyToMany; import jakarta.persistence.OneToMany; import jakarta.persistence.Table; -import org.hibernate.annotations.Where; -import org.hibernate.annotations.WhereJoinTable; +import org.hibernate.annotations.SQLJoinTableRestriction; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase; @@ -172,7 +172,7 @@ public class EagerToManyWhereTest extends BaseNonConfigCoreFunctionalTestCase { @OneToMany(fetch = FetchType.EAGER) @JoinColumn - @Where( clause = "description is not null" ) + @SQLRestriction( "description is not null" ) private Set categoriesWithDescOneToMany = new HashSet<>(); @ManyToMany(fetch = FetchType.EAGER) @@ -181,19 +181,19 @@ public class EagerToManyWhereTest extends BaseNonConfigCoreFunctionalTestCase { @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name = "categoriesWithDescManyToMany", inverseJoinColumns = { @JoinColumn( name = "categoryId" )}) - @Where( clause = "description is not null" ) + @SQLRestriction( "description is not null" ) private Set categoriesWithDescManyToMany = new HashSet<>(); @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name = "categoriesWithDescIdLt4MToM", inverseJoinColumns = { @JoinColumn( name = "categoryId" )}) - @Where( clause = "description is not null" ) - @WhereJoinTable( clause = "categoryId < 4") + @SQLRestriction( "description is not null" ) + @SQLJoinTableRestriction( "categoryId < 4") private Set categoriesWithDescIdLt4ManyToMany = new HashSet<>(); } @Entity(name = "Category") @Table(name = "CATEGORY") - @Where(clause = "inactive = 0") + @SQLRestriction("inactive = 0") public static class Category { @Id private int id; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerToManyWhereUseClassWhereTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerToManyWhereUseClassWhereTest.java index 7e67604e2f..6a1d203a2c 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerToManyWhereUseClassWhereTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerToManyWhereUseClassWhereTest.java @@ -20,8 +20,8 @@ import jakarta.persistence.ManyToMany; import jakarta.persistence.OneToMany; import jakarta.persistence.Table; -import org.hibernate.annotations.Where; -import org.hibernate.annotations.WhereJoinTable; +import org.hibernate.annotations.SQLJoinTableRestriction; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.cfg.AvailableSettings; import org.hibernate.testing.TestForIssue; @@ -178,7 +178,7 @@ public class EagerToManyWhereUseClassWhereTest extends BaseNonConfigCoreFunction @OneToMany(fetch = FetchType.EAGER) @JoinColumn - @Where( clause = "description is not null" ) + @SQLRestriction( "description is not null" ) private Set categoriesWithDescOneToMany = new HashSet<>(); @ManyToMany(fetch = FetchType.EAGER) @@ -187,19 +187,19 @@ public class EagerToManyWhereUseClassWhereTest extends BaseNonConfigCoreFunction @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name = "categoriesWithDescManyToMany", inverseJoinColumns = { @JoinColumn( name = "categoryId" )}) - @Where( clause = "description is not null" ) + @SQLRestriction( "description is not null" ) private Set categoriesWithDescManyToMany = new HashSet<>(); @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name = "categoriesWithDescIdLt4MToM", inverseJoinColumns = { @JoinColumn( name = "categoryId" )}) - @Where( clause = "description is not null" ) - @WhereJoinTable( clause = "categoryId < 4") + @SQLRestriction( "description is not null" ) + @SQLJoinTableRestriction("categoryId < 4") private Set categoriesWithDescIdLt4ManyToMany = new HashSet<>(); } @Entity(name = "Category") @Table(name = "CATEGORY") - @Where(clause = "inactive = 0") + @SQLRestriction("inactive = 0") public static class Category { @Id private int id; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerToManyWhereUseClassWhereViaAnnotationTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerToManyWhereUseClassWhereViaAnnotationTest.java index 1df2f9acc3..2c1b4bdac2 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerToManyWhereUseClassWhereViaAnnotationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/EagerToManyWhereUseClassWhereViaAnnotationTest.java @@ -15,16 +15,14 @@ import jakarta.persistence.JoinTable; import jakarta.persistence.ManyToMany; import jakarta.persistence.OneToMany; import jakarta.persistence.Table; -import org.hibernate.annotations.Where; -import org.hibernate.annotations.WhereJoinTable; -import org.hibernate.cfg.AvailableSettings; +import org.hibernate.annotations.SQLJoinTableRestriction; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase; import org.junit.Test; import java.util.Arrays; import java.util.HashSet; -import java.util.Map; import java.util.Set; import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate; @@ -172,7 +170,7 @@ public class EagerToManyWhereUseClassWhereViaAnnotationTest extends BaseNonConfi @OneToMany(fetch = FetchType.EAGER) @JoinColumn - @Where( clause = "description is not null" ) + @SQLRestriction( "description is not null" ) private Set categoriesWithDescOneToMany = new HashSet<>(); @ManyToMany(fetch = FetchType.EAGER) @@ -181,19 +179,19 @@ public class EagerToManyWhereUseClassWhereViaAnnotationTest extends BaseNonConfi @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name = "categoriesWithDescManyToMany", inverseJoinColumns = { @JoinColumn( name = "categoryId" )}) - @Where( clause = "description is not null" ) + @SQLRestriction( "description is not null" ) private Set categoriesWithDescManyToMany = new HashSet<>(); @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name = "categoriesWithDescIdLt4MToM", inverseJoinColumns = { @JoinColumn( name = "categoryId" )}) - @Where( clause = "description is not null" ) - @WhereJoinTable( clause = "categoryId < 4") + @SQLRestriction( "description is not null" ) + @SQLJoinTableRestriction("categoryId < 4") private Set categoriesWithDescIdLt4ManyToMany = new HashSet<>(); } @Entity(name = "Category") @Table(name = "CATEGORY") - @Where(clause = "inactive = 0") + @SQLRestriction("inactive = 0") public static class Category { @Id private int id; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyElementCollectionBasicNonUniqueIdWhereTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyElementCollectionBasicNonUniqueIdWhereTest.java index fe4393871e..eec4395671 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyElementCollectionBasicNonUniqueIdWhereTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyElementCollectionBasicNonUniqueIdWhereTest.java @@ -21,7 +21,7 @@ import jakarta.persistence.Table; import org.hibernate.Hibernate; import org.hibernate.Session; import org.hibernate.annotations.Immutable; -import org.hibernate.annotations.Where; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.dialect.H2Dialect; import org.hibernate.testing.RequiresDialect; import org.hibernate.testing.TestForIssue; @@ -195,7 +195,7 @@ public class LazyElementCollectionBasicNonUniqueIdWhereTest extends BaseCoreFunc @Entity( name = "Material" ) @Table( name = "MAIN_TABLE" ) - @Where( clause = "CODE = 'MATERIAL'" ) + @SQLRestriction("CODE = 'MATERIAL'" ) public static class Material { private int id; @@ -227,7 +227,7 @@ public class LazyElementCollectionBasicNonUniqueIdWhereTest extends BaseCoreFunc joinColumns = { @JoinColumn( name = "MAIN_ID" ) } ) @Column( name="VAL") - @Where( clause = "MAIN_CODE='MATERIAL' AND VALUE_CODE='SIZE'") + @SQLRestriction("MAIN_CODE='MATERIAL' AND VALUE_CODE='SIZE'") @Immutable public Set getSizesFromCombined() { return sizesFromCombined; @@ -253,7 +253,7 @@ public class LazyElementCollectionBasicNonUniqueIdWhereTest extends BaseCoreFunc @Entity( name = "Building" ) @Table( name = "MAIN_TABLE" ) - @Where( clause = "CODE = 'BUILDING'" ) + @SQLRestriction("CODE = 'BUILDING'" ) public static class Building { private int id; private String name; @@ -284,7 +284,7 @@ public class LazyElementCollectionBasicNonUniqueIdWhereTest extends BaseCoreFunc joinColumns = { @JoinColumn( name = "MAIN_ID" ) } ) @Column( name="VAL") - @Where( clause = "MAIN_CODE='BUILDING' AND VALUE_CODE='SIZE'") + @SQLRestriction("MAIN_CODE='BUILDING' AND VALUE_CODE='SIZE'") @Immutable public Set getSizesFromCombined() { return sizesFromCombined; @@ -299,7 +299,7 @@ public class LazyElementCollectionBasicNonUniqueIdWhereTest extends BaseCoreFunc joinColumns = { @JoinColumn( name = "MAIN_ID" ) } ) @Column( name="VAL") - @Where( clause = "MAIN_CODE='BUILDING' AND VALUE_CODE='RATING'" ) + @SQLRestriction( "MAIN_CODE='BUILDING' AND VALUE_CODE='RATING'" ) @Immutable public Set getRatingsFromCombined() { return ratingsFromCombined; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyElementCollectionWithLazyManyToOneNonUniqueIdWhereTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyElementCollectionWithLazyManyToOneNonUniqueIdWhereTest.java index aef27585dd..ea71b3e592 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyElementCollectionWithLazyManyToOneNonUniqueIdWhereTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyElementCollectionWithLazyManyToOneNonUniqueIdWhereTest.java @@ -26,7 +26,7 @@ import jakarta.persistence.Table; import org.hibernate.Hibernate; import org.hibernate.Session; import org.hibernate.annotations.Immutable; -import org.hibernate.annotations.Where; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.dialect.H2Dialect; import org.hibernate.testing.RequiresDialect; import org.hibernate.testing.TestForIssue; @@ -208,7 +208,7 @@ public class LazyElementCollectionWithLazyManyToOneNonUniqueIdWhereTest extends @Entity( name = "Material" ) @Table( name = "MAIN_TABLE" ) - @Where( clause = "CODE = 'MATERIAL'" ) + @SQLRestriction( "CODE = 'MATERIAL'" ) public static class Material { private int id; @@ -242,7 +242,7 @@ public class LazyElementCollectionWithLazyManyToOneNonUniqueIdWhereTest extends @AssociationOverrides( value = { @AssociationOverride( name = "size", joinColumns = { @JoinColumn(name = "ASSOCIATION_ID") } ) } ) - @Where( clause = "MAIN_CODE='MATERIAL' AND ASSOCIATION_CODE='SIZE'") + @SQLRestriction("MAIN_CODE='MATERIAL' AND ASSOCIATION_CODE='SIZE'") @Immutable public Set getContainedSizesFromCombined() { return containedSizesFromCombined; @@ -270,7 +270,7 @@ public class LazyElementCollectionWithLazyManyToOneNonUniqueIdWhereTest extends @Entity( name = "Building" ) @Table( name = "MAIN_TABLE" ) - @Where( clause = "CODE = 'BUILDING'" ) + @SQLRestriction( "CODE = 'BUILDING'" ) public static class Building { private int id; private String name; @@ -300,7 +300,7 @@ public class LazyElementCollectionWithLazyManyToOneNonUniqueIdWhereTest extends name = "COLLECTION_TABLE", joinColumns = { @JoinColumn( name = "MAIN_ID" ) } ) - @Where( clause = "MAIN_CODE='BUILDING' AND ASSOCIATION_CODE='SIZE'") + @SQLRestriction("MAIN_CODE='BUILDING' AND ASSOCIATION_CODE='SIZE'") @Immutable public Set getContainedSizesFromCombined() { return containedSizesFromCombined; @@ -314,7 +314,7 @@ public class LazyElementCollectionWithLazyManyToOneNonUniqueIdWhereTest extends name = "COLLECTION_TABLE", joinColumns = { @JoinColumn( name = "MAIN_ID" ) } ) - @Where( clause = "MAIN_CODE='BUILDING' AND ASSOCIATION_CODE='RATING'" ) + @SQLRestriction( "MAIN_CODE='BUILDING' AND ASSOCIATION_CODE='RATING'" ) @Immutable public Set getContainedRatingsFromCombined() { return containedRatingsFromCombined; @@ -327,7 +327,7 @@ public class LazyElementCollectionWithLazyManyToOneNonUniqueIdWhereTest extends @Entity( name = "Size" ) @Table( name = "MAIN_TABLE" ) - @Where( clause = "CODE = 'SIZE'" ) + @SQLRestriction( "CODE = 'SIZE'" ) public static class Size { private int id; private String name; @@ -366,7 +366,7 @@ public class LazyElementCollectionWithLazyManyToOneNonUniqueIdWhereTest extends @Entity( name = "Rating" ) @Table( name = "MAIN_TABLE" ) - @Where( clause = "CODE = 'RATING'" ) + @SQLRestriction( "CODE = 'RATING'" ) public static class Rating { private int id; private String name; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyManyToManyNonUniqueIdWhereTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyManyToManyNonUniqueIdWhereTest.java index 94810ac013..53288aa83a 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyManyToManyNonUniqueIdWhereTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyManyToManyNonUniqueIdWhereTest.java @@ -22,8 +22,8 @@ import jakarta.persistence.Table; import org.hibernate.Hibernate; import org.hibernate.annotations.Immutable; -import org.hibernate.annotations.Where; -import org.hibernate.annotations.WhereJoinTable; +import org.hibernate.annotations.SQLJoinTableRestriction; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.cfg.Configuration; import org.hibernate.metamodel.CollectionClassification; @@ -265,7 +265,7 @@ public class LazyManyToManyNonUniqueIdWhereTest extends BaseCoreFunctionalTestCa @Entity( name = "Material" ) @Table( name = "MAIN_TABLE" ) - @Where( clause = "CODE = 'MATERIAL'" ) + @SQLRestriction( "CODE = 'MATERIAL'" ) public static class Material { private int id; @@ -297,7 +297,7 @@ public class LazyManyToManyNonUniqueIdWhereTest extends BaseCoreFunctionalTestCa joinColumns = { @JoinColumn( name = "MAIN_ID" ) }, inverseJoinColumns = { @JoinColumn( name = "ASSOCIATION_ID" ) } ) - @WhereJoinTable( clause = "MAIN_CODE='MATERIAL' AND ASSOCIATION_CODE='SIZE'") + @SQLJoinTableRestriction("MAIN_CODE='MATERIAL' AND ASSOCIATION_CODE='SIZE'") @Immutable public Set getSizesFromCombined() { return sizesFromCombined; @@ -312,8 +312,8 @@ public class LazyManyToManyNonUniqueIdWhereTest extends BaseCoreFunctionalTestCa joinColumns = { @JoinColumn( name = "MAIN_ID" ) }, inverseJoinColumns = { @JoinColumn( name = "ASSOCIATION_ID" ) } ) - @WhereJoinTable( clause = "MAIN_CODE='MATERIAL' AND ASSOCIATION_CODE='RATING'" ) - @Where( clause = "NAME = 'high' or NAME = 'medium'" ) + @SQLJoinTableRestriction( "MAIN_CODE='MATERIAL' AND ASSOCIATION_CODE='RATING'" ) + @SQLRestriction( "NAME = 'high' or NAME = 'medium'" ) @Immutable public List getMediumOrHighRatingsFromCombined() { return mediumOrHighRatingsFromCombined; @@ -339,7 +339,7 @@ public class LazyManyToManyNonUniqueIdWhereTest extends BaseCoreFunctionalTestCa @Entity( name = "Building" ) @Table( name = "MAIN_TABLE" ) - @Where( clause = "CODE = 'BUILDING'" ) + @SQLRestriction( "CODE = 'BUILDING'" ) public static class Building { private int id; private String name; @@ -370,7 +370,7 @@ public class LazyManyToManyNonUniqueIdWhereTest extends BaseCoreFunctionalTestCa joinColumns = { @JoinColumn( name = "MAIN_ID" ) }, inverseJoinColumns = { @JoinColumn( name = "ASSOCIATION_ID" ) } ) - @WhereJoinTable( clause = "MAIN_CODE='BUILDING' AND ASSOCIATION_CODE='SIZE'") + @SQLJoinTableRestriction("MAIN_CODE='BUILDING' AND ASSOCIATION_CODE='SIZE'") @Immutable public Set getSizesFromCombined() { return sizesFromCombined; @@ -385,7 +385,7 @@ public class LazyManyToManyNonUniqueIdWhereTest extends BaseCoreFunctionalTestCa joinColumns = { @JoinColumn( name = "MAIN_ID" ) }, inverseJoinColumns = { @JoinColumn( name = "ASSOCIATION_ID" ) } ) - @WhereJoinTable( clause = "MAIN_CODE='BUILDING' AND ASSOCIATION_CODE='RATING'" ) + @SQLJoinTableRestriction("MAIN_CODE='BUILDING' AND ASSOCIATION_CODE='RATING'" ) @Immutable public Set getRatingsFromCombined() { return ratingsFromCombined; @@ -400,7 +400,7 @@ public class LazyManyToManyNonUniqueIdWhereTest extends BaseCoreFunctionalTestCa joinColumns = { @JoinColumn( name = "BUILDING_ID") }, inverseJoinColumns = { @JoinColumn( name = "RATING_ID" ) } ) - @Where( clause = "NAME = 'high' or NAME = 'medium'" ) + @SQLRestriction( "NAME = 'high' or NAME = 'medium'" ) @Immutable public List getMediumOrHighRatings() { return mediumOrHighRatings; @@ -412,7 +412,7 @@ public class LazyManyToManyNonUniqueIdWhereTest extends BaseCoreFunctionalTestCa @Entity( name = "Size" ) @Table( name = "MAIN_TABLE" ) - @Where( clause = "CODE = 'SIZE'" ) + @SQLRestriction( "CODE = 'SIZE'" ) public static class Size { private int id; private String name; @@ -437,7 +437,7 @@ public class LazyManyToManyNonUniqueIdWhereTest extends BaseCoreFunctionalTestCa @Entity( name = "Rating" ) @Table( name = "MAIN_TABLE" ) - @Where( clause = "CODE = 'RATING'" ) + @SQLRestriction( "CODE = 'RATING'" ) public static class Rating { private int id; private String name; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyOneToManyNonUniqueIdWhereTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyOneToManyNonUniqueIdWhereTest.java index 9552808d2f..4657bdba24 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyOneToManyNonUniqueIdWhereTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyOneToManyNonUniqueIdWhereTest.java @@ -20,7 +20,7 @@ import jakarta.persistence.Table; import org.hibernate.Hibernate; import org.hibernate.annotations.Immutable; -import org.hibernate.annotations.Where; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.cfg.Configuration; import org.hibernate.metamodel.CollectionClassification; @@ -174,7 +174,7 @@ public class LazyOneToManyNonUniqueIdWhereTest extends BaseCoreFunctionalTestCas @Entity( name = "Material" ) @Table( name = "MAIN_TABLE" ) - @Where( clause = "CODE = 'MATERIAL'" ) + @SQLRestriction( "CODE = 'MATERIAL'" ) public static class Material { private int id; @@ -211,7 +211,7 @@ public class LazyOneToManyNonUniqueIdWhereTest extends BaseCoreFunctionalTestCas @OneToMany @JoinColumn( name = "MATERIAL_OWNER_ID") - @Where( clause = "NAME = 'high' or NAME = 'medium'" ) + @SQLRestriction( "NAME = 'high' or NAME = 'medium'" ) @Immutable public List getMediumOrHighRatingsFromCombined() { return mediumOrHighRatingsFromCombined; @@ -223,7 +223,7 @@ public class LazyOneToManyNonUniqueIdWhereTest extends BaseCoreFunctionalTestCas @Entity( name = "Building" ) @Table( name = "MAIN_TABLE" ) - @Where( clause = "CODE = 'BUILDING'" ) + @SQLRestriction( "CODE = 'BUILDING'" ) public static class Building { private int id; private String name; @@ -271,7 +271,7 @@ public class LazyOneToManyNonUniqueIdWhereTest extends BaseCoreFunctionalTestCas @Entity( name = "Size" ) @Table( name = "MAIN_TABLE" ) - @Where( clause = "CODE = 'SIZE'" ) + @SQLRestriction( "CODE = 'SIZE'" ) public static class Size { private int id; private String name; @@ -296,7 +296,7 @@ public class LazyOneToManyNonUniqueIdWhereTest extends BaseCoreFunctionalTestCas @Entity( name = "Rating" ) @Table( name = "MAIN_TABLE" ) - @Where( clause = "CODE = 'RATING'" ) + @SQLRestriction( "CODE = 'RATING'" ) public static class Rating { private int id; private String name; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyToManyWhereDontUseClassWhereTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyToManyWhereDontUseClassWhereTest.java index 54771e493c..c39c092818 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyToManyWhereDontUseClassWhereTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyToManyWhereDontUseClassWhereTest.java @@ -20,8 +20,8 @@ import jakarta.persistence.ManyToMany; import jakarta.persistence.OneToMany; import jakarta.persistence.Table; -import org.hibernate.annotations.Where; -import org.hibernate.annotations.WhereJoinTable; +import org.hibernate.annotations.SQLJoinTableRestriction; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.cfg.AvailableSettings; import org.hibernate.testing.TestForIssue; @@ -178,7 +178,7 @@ public class LazyToManyWhereDontUseClassWhereTest extends BaseNonConfigCoreFunct @OneToMany(fetch = FetchType.LAZY) @JoinColumn - @Where( clause = "description is not null" ) + @SQLRestriction( "description is not null" ) private Set categoriesWithDescOneToMany = new HashSet<>(); @ManyToMany(fetch = FetchType.LAZY) @@ -187,19 +187,19 @@ public class LazyToManyWhereDontUseClassWhereTest extends BaseNonConfigCoreFunct @ManyToMany(fetch = FetchType.LAZY) @JoinTable(name = "categoriesWithDescManyToMany", inverseJoinColumns = { @JoinColumn( name = "categoryId" )}) - @Where( clause = "description is not null" ) + @SQLRestriction( "description is not null" ) private Set categoriesWithDescManyToMany = new HashSet<>(); @ManyToMany(fetch = FetchType.LAZY) @JoinTable(name = "categoriesWithDescIdLt4MToM", inverseJoinColumns = { @JoinColumn( name = "categoryId" )}) - @Where( clause = "description is not null" ) - @WhereJoinTable( clause = "categoryId < 4") + @SQLRestriction( "description is not null" ) + @SQLJoinTableRestriction( "categoryId < 4") private Set categoriesWithDescIdLt4ManyToMany = new HashSet<>(); } @Entity(name = "Category") @Table(name = "CATEGORY") - @Where(clause = "inactive = 0") + @SQLRestriction("inactive = 0") public static class Category { @Id private int id; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyToManyWhereTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyToManyWhereTest.java index 1870361839..71932735a8 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyToManyWhereTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyToManyWhereTest.java @@ -19,8 +19,8 @@ import jakarta.persistence.ManyToMany; import jakarta.persistence.OneToMany; import jakarta.persistence.Table; -import org.hibernate.annotations.Where; -import org.hibernate.annotations.WhereJoinTable; +import org.hibernate.annotations.SQLJoinTableRestriction; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase; @@ -172,7 +172,7 @@ public class LazyToManyWhereTest extends BaseNonConfigCoreFunctionalTestCase { @OneToMany(fetch = FetchType.LAZY) @JoinColumn - @Where( clause = "description is not null" ) + @SQLRestriction( "description is not null" ) private Set categoriesWithDescOneToMany = new HashSet<>(); @ManyToMany(fetch = FetchType.LAZY) @@ -181,19 +181,19 @@ public class LazyToManyWhereTest extends BaseNonConfigCoreFunctionalTestCase { @ManyToMany(fetch = FetchType.LAZY) @JoinTable(name = "categoriesWithDescManyToMany", inverseJoinColumns = { @JoinColumn( name = "categoryId" )}) - @Where( clause = "description is not null" ) + @SQLRestriction( "description is not null" ) private Set categoriesWithDescManyToMany = new HashSet<>(); @ManyToMany(fetch = FetchType.LAZY) @JoinTable(name = "categoriesWithDescIdLt4MToM", inverseJoinColumns = { @JoinColumn( name = "categoryId" )}) - @Where( clause = "description is not null" ) - @WhereJoinTable( clause = "categoryId < 4") + @SQLRestriction("description is not null" ) + @SQLJoinTableRestriction("categoryId < 4") private Set categoriesWithDescIdLt4ManyToMany = new HashSet<>(); } @Entity(name = "Category") @Table(name = "CATEGORY") - @Where(clause = "inactive = 0") + @SQLRestriction("inactive = 0") public static class Category { @Id private int id; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyToManyWhereUseClassWhereTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyToManyWhereUseClassWhereTest.java index 7af734c01b..004f09de64 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyToManyWhereUseClassWhereTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/LazyToManyWhereUseClassWhereTest.java @@ -20,8 +20,8 @@ import jakarta.persistence.ManyToMany; import jakarta.persistence.OneToMany; import jakarta.persistence.Table; -import org.hibernate.annotations.Where; -import org.hibernate.annotations.WhereJoinTable; +import org.hibernate.annotations.SQLJoinTableRestriction; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.cfg.AvailableSettings; import org.hibernate.testing.TestForIssue; @@ -178,7 +178,7 @@ public class LazyToManyWhereUseClassWhereTest extends BaseNonConfigCoreFunctiona @OneToMany(fetch = FetchType.LAZY) @JoinColumn - @Where( clause = "description is not null" ) + @SQLRestriction( "description is not null" ) private Set categoriesWithDescOneToMany = new HashSet<>(); @ManyToMany(fetch = FetchType.LAZY) @@ -187,19 +187,19 @@ public class LazyToManyWhereUseClassWhereTest extends BaseNonConfigCoreFunctiona @ManyToMany(fetch = FetchType.LAZY) @JoinTable(name = "categoriesWithDescManyToMany", inverseJoinColumns = { @JoinColumn( name = "categoryId" )}) - @Where( clause = "description is not null" ) + @SQLRestriction( "description is not null" ) private Set categoriesWithDescManyToMany = new HashSet<>(); @ManyToMany(fetch = FetchType.LAZY) @JoinTable(name = "categoriesWithDescIdLt4MToM", inverseJoinColumns = { @JoinColumn( name = "categoryId" )}) - @Where( clause = "description is not null" ) - @WhereJoinTable( clause = "categoryId < 4") + @SQLRestriction("description is not null" ) + @SQLJoinTableRestriction("categoryId < 4") private Set categoriesWithDescIdLt4ManyToMany = new HashSet<>(); } @Entity(name = "Category") @Table(name = "CATEGORY") - @Where(clause = "inactive = 0") + @SQLRestriction("inactive = 0") public static class Category { @Id private int id; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/NullWhereClauseTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/NullWhereClauseTest.java index 8096faac42..7ccb5786c7 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/NullWhereClauseTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/where/annotations/NullWhereClauseTest.java @@ -1,6 +1,6 @@ package org.hibernate.orm.test.where.annotations; -import org.hibernate.annotations.Where; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.cfg.AvailableSettings; import org.hibernate.testing.TestForIssue; @@ -33,7 +33,7 @@ public class NullWhereClauseTest { @Entity @Table(name = "person") - @Where(clause = "`used` IS NULL") + @SQLRestriction("`used` IS NULL") public static class Person { @Id private Integer id; diff --git a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/entities/manytomany/WhereJoinTableEntity.java b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/entities/manytomany/WhereJoinTableEntity.java index 2d7fed52af..0002db6861 100644 --- a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/entities/manytomany/WhereJoinTableEntity.java +++ b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/entities/manytomany/WhereJoinTableEntity.java @@ -14,7 +14,7 @@ import jakarta.persistence.JoinColumn; import jakarta.persistence.JoinTable; import jakarta.persistence.ManyToMany; -import org.hibernate.annotations.WhereJoinTable; +import org.hibernate.annotations.SQLJoinTableRestriction; import org.hibernate.envers.Audited; import org.hibernate.orm.test.envers.entities.IntNoAutoIdTestEntity; @@ -36,7 +36,7 @@ public class WhereJoinTableEntity { joinColumns = @JoinColumn(name = "wjte_id"), inverseJoinColumns = @JoinColumn(name = "ite_id") ) - @WhereJoinTable(clause = "ite_id < 20") + @SQLJoinTableRestriction("ite_id < 20") private List references1; @ManyToMany @@ -45,7 +45,7 @@ public class WhereJoinTableEntity { joinColumns = @JoinColumn(name = "wjte_id"), inverseJoinColumns = @JoinColumn(name = "ite_id") ) - @WhereJoinTable(clause = "ite_id >= 20") + @SQLJoinTableRestriction("ite_id >= 20") private List references2; public Integer getId() { diff --git a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/entities/manytomany/sametable/Child1Entity.java b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/entities/manytomany/sametable/Child1Entity.java index ac0d3cbf2f..999a8d220c 100644 --- a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/entities/manytomany/sametable/Child1Entity.java +++ b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/entities/manytomany/sametable/Child1Entity.java @@ -16,6 +16,7 @@ import jakarta.persistence.JoinColumn; import jakarta.persistence.JoinTable; import jakarta.persistence.ManyToMany; +import org.hibernate.annotations.SQLJoinTableRestriction; import org.hibernate.annotations.WhereJoinTable; import org.hibernate.envers.Audited; @@ -49,7 +50,7 @@ public class Child1Entity { joinColumns = @JoinColumn(name = "child1_id"), inverseJoinColumns = @JoinColumn(name = "parent_id", insertable = false, updatable = false) ) - @WhereJoinTable(clause = "child1_id is not null") + @SQLJoinTableRestriction("child1_id is not null") private List parents = new ArrayList(); public Integer getId() { diff --git a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/entities/manytomany/sametable/Child2Entity.java b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/entities/manytomany/sametable/Child2Entity.java index 0ec3ce3185..8eb0e519fa 100644 --- a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/entities/manytomany/sametable/Child2Entity.java +++ b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/entities/manytomany/sametable/Child2Entity.java @@ -16,7 +16,7 @@ import jakarta.persistence.JoinColumn; import jakarta.persistence.JoinTable; import jakarta.persistence.ManyToMany; -import org.hibernate.annotations.WhereJoinTable; +import org.hibernate.annotations.SQLJoinTableRestriction; import org.hibernate.envers.Audited; /** @@ -49,7 +49,7 @@ public class Child2Entity { joinColumns = @JoinColumn(name = "child2_id"), inverseJoinColumns = @JoinColumn(name = "parent_id", insertable = false, updatable = false) ) - @WhereJoinTable(clause = "child2_id is not null") + @SQLJoinTableRestriction("child2_id is not null") private List parents = new ArrayList(); public Integer getId() { diff --git a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/entities/manytomany/sametable/ParentEntity.java b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/entities/manytomany/sametable/ParentEntity.java index 6387456b00..9b8bfd33a0 100644 --- a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/entities/manytomany/sametable/ParentEntity.java +++ b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/entities/manytomany/sametable/ParentEntity.java @@ -16,7 +16,7 @@ import jakarta.persistence.JoinColumn; import jakarta.persistence.JoinTable; import jakarta.persistence.ManyToMany; -import org.hibernate.annotations.WhereJoinTable; +import org.hibernate.annotations.SQLJoinTableRestriction; import org.hibernate.envers.Audited; /** @@ -49,7 +49,7 @@ public class ParentEntity { joinColumns = @JoinColumn(name = "parent_id"), inverseJoinColumns = @JoinColumn(name = "child1_id", insertable = false, updatable = false) ) - @WhereJoinTable(clause = "child1_id is not null") + @SQLJoinTableRestriction("child1_id is not null") private List children1 = new ArrayList(); @ManyToMany(fetch = FetchType.LAZY) @@ -58,7 +58,7 @@ public class ParentEntity { joinColumns = @JoinColumn(name = "parent_id"), inverseJoinColumns = @JoinColumn(name = "child2_id", insertable = false, updatable = false) ) - @WhereJoinTable(clause = "child2_id is not null") + @SQLJoinTableRestriction("child2_id is not null") private List children2 = new ArrayList(); public Integer getId() { diff --git a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/manytomany/BasicWhereTest.java b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/manytomany/BasicWhereTest.java index 5476ec9847..d2d30c5cfe 100644 --- a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/manytomany/BasicWhereTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/manytomany/BasicWhereTest.java @@ -18,6 +18,7 @@ import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToMany; import jakarta.persistence.Table; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.annotations.Where; import org.hibernate.envers.AuditJoinTable; import org.hibernate.envers.Audited; @@ -116,7 +117,7 @@ public class BasicWhereTest extends BaseEnversJPAFunctionalTestCase { @ManyToMany @JoinColumn(name = "allC") - @Where(clause = "type = 'C'") + @SQLRestriction("type = 'C'") @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED) @AuditJoinTable(name = "A_C_AUD") private Set allMyC; @@ -190,7 +191,7 @@ public class BasicWhereTest extends BaseEnversJPAFunctionalTestCase { private String name; @ManyToMany - @Where(clause = "type = 'Z'") + @SQLRestriction("type = 'Z'") @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED) private Set allMyZ; diff --git a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/onetomany/BasicWhereTest.java b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/onetomany/BasicWhereTest.java index a6fd450640..6ea8ea4917 100644 --- a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/onetomany/BasicWhereTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/onetomany/BasicWhereTest.java @@ -18,6 +18,7 @@ import jakarta.persistence.JoinColumn; import jakarta.persistence.OneToMany; import jakarta.persistence.Table; +import org.hibernate.annotations.SQLRestriction; import org.hibernate.annotations.Where; import org.hibernate.envers.AuditJoinTable; import org.hibernate.envers.Audited; @@ -118,7 +119,7 @@ public class BasicWhereTest extends BaseEnversJPAFunctionalTestCase { @OneToMany @JoinColumn(name = "allC") - @Where(clause = "type = 'C'") + @SQLRestriction("type = 'C'") @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED) @AuditJoinTable(name = "A_C_AUD") private Set allMyC; @@ -192,7 +193,7 @@ public class BasicWhereTest extends BaseEnversJPAFunctionalTestCase { private String name; @OneToMany - @Where(clause = "type = 'Z'") + @SQLRestriction("type = 'Z'") @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED) private Set allMyZ; diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/orm/domain/gambit/EntityOfMaps.java b/hibernate-testing/src/main/java/org/hibernate/testing/orm/domain/gambit/EntityOfMaps.java index d1990f5b84..fcc55d6c7a 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/orm/domain/gambit/EntityOfMaps.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/orm/domain/gambit/EntityOfMaps.java @@ -25,7 +25,7 @@ import jakarta.persistence.MapKeyEnumerated; import jakarta.persistence.MapKeyJoinColumn; import jakarta.persistence.OneToMany; -import org.hibernate.annotations.OrderBy; +import org.hibernate.annotations.SQLOrder; import org.hibernate.annotations.SortComparator; import org.hibernate.annotations.SortNatural; @@ -367,7 +367,7 @@ public class EntityOfMaps { @ElementCollection @MapKeyColumn( name = "ordered_component_key") - @OrderBy( clause = "ordered_component_key, ordered_component_key" ) + @SQLOrder( "ordered_component_key, ordered_component_key" ) @CollectionTable(name = "EntityOfMaps_comp_basic2") public Map getComponentByBasicOrdered() { return componentByBasicOrdered;