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 @@ -64,14 +64,12 @@ public TableReference getTableReference(
NavigablePath navigablePath,
String tableExpression,
boolean resolve) {
return mutatingTableReference.getTableExpression().equals( tableExpression )
? mutatingTableReference
: null;
return mutatingTableReference.getTableReference( tableExpression );
}

@Override
public void applyAffectedTableNames(Consumer<String> nameCollector) {
nameCollector.accept( mutatingTableReference.getTableExpression() );
mutatingTableReference.applyAffectedTableNames( nameCollector);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.orm.test.query.mutationquery;

import java.util.List;

import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.Jira;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.Test;

import jakarta.persistence.ElementCollection;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Inheritance;
import jakarta.persistence.InheritanceType;

@SessionFactory
@DomainModel(annotatedClasses = {
MutationQueriesCollectionTableTest.Base1.class,
MutationQueriesCollectionTableTest.Table1.class
})
@Jira("https://hibernate.atlassian.net/browse/HHH-19740")
public class MutationQueriesCollectionTableTest {

@Test
public void testDelete(SessionFactoryScope scope) {
scope.inTransaction( session -> {
session.createQuery( "delete from Table1 where name = :name" )

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
QueryProducerImplementor.createQuery
should be avoided because it has been deprecated.
.setParameter( "name", "test" )
.executeUpdate();
} );
}

@Entity(name = "Base1")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract static class Base1 {

@Id
private Long id;

@SuppressWarnings("unused")
private String name;

@ElementCollection
private List<String> roles;

}

@Entity(name = "Table1")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public static class Table1 extends Base1 {

}
}