|
| 1 | +/* |
| 2 | + * Hibernate, Relational Persistence for Idiomatic Java |
| 3 | + * |
| 4 | + * License: GNU Lesser General Public License (LGPL), version 2.1 or later |
| 5 | + * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html |
| 6 | + */ |
| 7 | +package org.hibernate.orm.test.query.mutationquery; |
| 8 | + |
| 9 | +import java.util.List; |
| 10 | + |
| 11 | +import org.hibernate.testing.orm.junit.DomainModel; |
| 12 | +import org.hibernate.testing.orm.junit.Jira; |
| 13 | +import org.hibernate.testing.orm.junit.SessionFactory; |
| 14 | +import org.hibernate.testing.orm.junit.SessionFactoryScope; |
| 15 | +import org.junit.jupiter.api.Test; |
| 16 | + |
| 17 | +import jakarta.persistence.ElementCollection; |
| 18 | +import jakarta.persistence.Entity; |
| 19 | +import jakarta.persistence.Id; |
| 20 | +import jakarta.persistence.Inheritance; |
| 21 | +import jakarta.persistence.InheritanceType; |
| 22 | + |
| 23 | +@SessionFactory |
| 24 | +@DomainModel(annotatedClasses = { |
| 25 | + MutationQueriesCollectionTableTest.Base1.class, |
| 26 | + MutationQueriesCollectionTableTest.Table1.class |
| 27 | +}) |
| 28 | +@Jira("https://hibernate.atlassian.net/browse/HHH-19740") |
| 29 | +public class MutationQueriesCollectionTableTest { |
| 30 | + |
| 31 | + @Test |
| 32 | + public void testDelete(SessionFactoryScope scope) { |
| 33 | + scope.inTransaction( session -> { |
| 34 | + session.createQuery( "delete from Table1 where name = :name" ) |
| 35 | + .setParameter( "name", "test" ) |
| 36 | + .executeUpdate(); |
| 37 | + } ); |
| 38 | + } |
| 39 | + |
| 40 | + @Entity(name = "Base1") |
| 41 | + @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) |
| 42 | + public abstract static class Base1 { |
| 43 | + |
| 44 | + @Id |
| 45 | + private Long id; |
| 46 | + |
| 47 | + @SuppressWarnings("unused") |
| 48 | + private String name; |
| 49 | + |
| 50 | + @ElementCollection |
| 51 | + private List<String> roles; |
| 52 | + |
| 53 | + } |
| 54 | + |
| 55 | + @Entity(name = "Table1") |
| 56 | + @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) |
| 57 | + public static class Table1 extends Base1 { |
| 58 | + |
| 59 | + } |
| 60 | +} |
0 commit comments